473,395 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Two forms

*** This is the first form i called it Form1?******
************************************************** ********

Expand|Select|Wrap|Line Numbers
  1. Imports System.Xml
  2. Imports System.IO
  3. Public Class Form1
  4.     Inherits System.Windows.Forms.Form
  5.  
  6.  Private Sub btnFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lodbtn.Click
  7.  
  8.         Dim ofd As OpenFileDialog = New OpenFileDialog
  9.         Dim result As DialogResult = ofd.ShowDialog()
  10.         If result = DialogResult.Cancel Then
  11.             Return
  12.         End If
  13.  
  14.         Dim document As XmlDocument = New XmlDocument
  15.         document.Load(ofd.FileName)
  16.  
  17.         Dim reader As XmlNodeReader = New XmlNodeReader(document)
  18.         MsgBox("The File is loaded successfully!")
  19.  
  20.         lblLoad.Text = (System.IO.Path.GetFullPath(ofd.FileName))
  21.  
  22.         Disbtn.Enabled = True
  23.  
  24.  
  25.  
  26.     End Sub
  27.  
  28.     Private Sub Displaybtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Disbtn.Click
  29.         Dim f As CourseDisplay
  30.         f = New CourseDisplay
  31.         f.Show()
  32.     End Sub
  33.  
  34.  
  35.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  36.  
  37.     End Sub
********* This is the second form i called it CourseDisplay.vb***********
************************************************** *******************************

Expand|Select|Wrap|Line Numbers
  1. Imports System.Xml
  2. Imports System.IO
  3. Public Class CourseDisplay
  4. Inherits System.Windows.Forms.Form
  5.  
  6. Private Sub Display_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.  
  8.  
  9.         Dim document As XmlDocument = New XmlDocument
  10.         document.Load("CP2830.xml")
  11.  
  12.         Dim reader As XmlNodeReader = New XmlNodeReader(document)
  13.  
  14.         While reader.Read()
  15.  
  16.             If reader.Name = "courseID" Then
  17.                 Label1.Text = reader.ReadElementString()
  18.             End If
  19.  
  20.             If reader.Name = "courseName" Then
  21.                 Label2.Text = reader.ReadElementString()
  22.             End If
  23.   End While
  24.  
  25.  
  26.         For i = 0 To Student.GetUpperBound(0)
  27.             sum += Convert.ToInt32(Student(i))
  28.         Next
  29.  
  30.         Label4.Text = studnetcount
  31.  
  32.     End Sub
  33.  
  34.     Private Sub clobtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clobtn.Click
  35.  
  36.         Me.Close()
  37.  
  38.     End Sub
  39. End Class
  40.  
that what i did

*********** the problem is how can i leave it to read the studnent

or how i can do this ( that i have to do it )

tempStr is a stirng variable
studentCount is an integer variable
studentCount =0
WHILE there are more tags

if tag is "courseID"
read contents and display on form
END IF

if tag is " courseName"
read contents and display on form
END IF
if tag is "studnet"
tempStr = " "
Skip to next tag
we are now on studnetID
read contents of tag , add to tempStr, advance

we are now on studnetName
read contents of tag , add to tempStr, advance

we are now on porgram
read contents of tag , add to tempStr, advance

Display tempStr on form
Add 1 to studnentCount
Oct 15 '07 #1
14 1294
debasisdas
8,127 Expert 4TB
Question moved to .NET Forum.
Oct 15 '07 #2
kenobewan
4,871 Expert 4TB
Please give more information about your problem or error you are receiving. What are you trying to do? Thanks.
Oct 15 '07 #3
Please give more information about your problem or error you are receiving. What are you trying to do? Thanks.
I don't have error but i don't know how to do some steps .. the last one

please help me

*********** the problem is how can i leave it to read the studnent

or how i can do this ( that i have to do it )

tempStr is a stirng variable
studentCount is an integer variable
studentCount =0
WHILE there are more tags

if tag is "courseID"
read contents and display on form
END IF

if tag is " courseName"
read contents and display on form
END IF
if tag is "studnet"
tempStr = " "
Skip to next tag
we are now on studnetID
read contents of tag , add to tempStr, advance

we are now on studnetName
read contents of tag , add to tempStr, advance

we are now on porgram
read contents of tag , add to tempStr, advance

Display tempStr on form
Add 1 to studnentCount

--------------------------------------------------------------------------------
Oct 15 '07 #4
:( nobady can help me
Oct 15 '07 #5
Shashi Sadasivan
1,435 Expert 1GB
What are you trying to do?
Oct 15 '07 #6
What are you trying to do?
what i try to do

Dim document As XmlDocument = New XmlDocument
document.Load("CP2830.xml")

Dim reader As XmlNodeReader = New XmlNodeReader(document)

While reader.Read()

If reader.Name = "courseID" Then
Label1.Text = reader.ReadElementString()
End If

If reader.Name = "courseName" Then
Label2.Text = reader.ReadElementString()
End If

before i end the while i have to do this steps

tempStr is a stirng variable
studentCount is an integer variable
studentCount =0
WHILE there are more tags

if tag is "courseID"
read contents and display on form
END IF

if tag is " courseName"
read contents and display on form
END IF
if tag is "studnet"
tempStr = " "
Skip to next tag
we are now on studnetID
read contents of tag , add to tempStr, advance

we are now on studnetName
read contents of tag , add to tempStr, advance

we are now on porgram
read contents of tag , add to tempStr, advance

Display tempStr on form
Add 1 to studnentCount

after that i end while

i want to read every studnet id , name and program

now i clear or not
Oct 16 '07 #7
Frinavale
9,735 Expert Mod 8TB
what i try to do

Dim document As XmlDocument = New XmlDocument
document.Load("CP2830.xml")

Dim reader As XmlNodeReader = New XmlNodeReader(document)

While reader.Read()

If reader.Name = "courseID" Then
Label1.Text = reader.ReadElementString()
End If

If reader.Name = "courseName" Then
Label2.Text = reader.ReadElementString()
End If

before i end the while i have to do this steps

tempStr is a stirng variable
studentCount is an integer variable
studentCount =0
WHILE there are more tags

if tag is "courseID"
read contents and display on form
END IF

if tag is " courseName"
read contents and display on form
END IF
if tag is "studnet"
tempStr = " "
Skip to next tag
we are now on studnetID
read contents of tag , add to tempStr, advance

we are now on studnetName
read contents of tag , add to tempStr, advance

we are now on porgram
read contents of tag , add to tempStr, advance

Display tempStr on form
Add 1 to studnentCount

after that i end while

i want to read every studnet id , name and program

now i clear or not

Have you tried to just......write the code for this?

It appears that you know what you want to do.
Have you tried to Do It?
Oct 16 '07 #8
Have you tried to just......write the code for this?

It appears that you know what you want to do.
Have you tried to Do It?

yes i tried to do it but i don't now how to do it can you help me
Oct 17 '07 #9
My questions is hard or what nobady can help me or what
Oct 17 '07 #10
Shashi Sadasivan
1,435 Expert 1GB
For starters,
Its difficult to follow your code.
I would rather get back to work..than take some time off it and go through your code (There is no valid commenting, nor have you used the code tags)

Secondly, You do seem to have coded all what you want, but are failing to explain what you want to do.

So think about what you want (dont expect someone over here to write code for you)
We will be happy with fixing up your code.
Oct 17 '07 #11
Frinavale
9,735 Expert Mod 8TB
My questions is hard or what nobady can help me or what
First of all, It is difficult for the experts to answer questions when there is not enough details provided to understand the problem.

Secondly, to me it feels as if you are asking the us to do a homework assignment for you. It seems as if you have had some code given to you and you are to add onto the assignment or programming. It is also a rule here that members of this fourm not provide full solutions to homework problems.

The experts on this forum are more than happy to help you with a specific problem that you are facing.

Please attempt to solve the problem first and then post your question about specific problems that you are encountering.
Oct 18 '07 #12
Expand|Select|Wrap|Line Numbers
  1. Dim tempStr  as string' (tempStr is a stirng variable it) 
  2. Dim studentCount as integer = 0'(studentCount is an integer variable)
  3.  
  4. While reader.Read()   '((WHILE there are more tags)) 
  5.  
  6. '((if tag is "courseID"
  7. 'read contents and display on form
  8. 'END IF) )
  9.  
  10. If reader.Name = "courseID" Then
  11.     Label1.Text = reader.ReadElementString()
  12. End IF
  13.  
  14. '((if tag is " courseName"
  15. 'read contents and display on form
  16. 'END IF))
  17.  
  18. If reader.Name = "courseName" Then
  19.     Label2.Text = reader.ReadElementString()
  20. End If
  21.  
  22. '((((if tag is "studnet"
  23. 'tempStr = " "
  24. 'Skip to next tag
  25. 'we are now on studnetID
  26. 'read contents of tag , add to tempStr, advance
  27.  
  28. 'we are now on studnetName
  29. 'read contents of tag , add to tempStr, advance
  30.  
  31. 'we are now on porgram
  32. 'read contents of tag , add to tempStr, advance))))
  33.  
  34.  
  35. If reader.Name = "student" And reader.NodeType = XmlNodeType.Element Then
  36.                 tempStr = ""
  37.  
  38.                 If reader.Name = "studentID" Then
  39.                     ListBox1.Text = tempStr + reader.ReadElementString()
  40.                 End If
  41.                 If reader.Name = "studentName" Then
  42.                     ListBox1.Text = tempStr + reader.ReadElementString()
  43.                 End If
  44.                 If reader.Name = "program" Then
  45.                     ListBox1.Text = tempStr + reader.ReadElementString()
  46.                 End If
  47.             End If
  48.                 ReDim Preserve Student(index)
  49.                 Student(index) = reader.ReadElementString()
  50.                 index += 1
  51.                 studnetcount += 1
  52.             End If
  53.  
  54.  
  55.         For i = 0 To Student.GetUpperBound(0)
  56.             sum += Convert.ToInt32(Student(i))
  57.         Next
  58.  
  59.         Label4.Text = studnetcount
  60.  
  61.     End Sub
  62.         End While
when i did that nothing in the screen i don't know what problem it cant read the student id ,name and porgram

this is my work now do understand or no
Display tempStr on form
Add 1 to studnentCount
Oct 18 '07 #13
Frinavale
9,735 Expert Mod 8TB
I'm not sure what type of object your reader variable is.
It's the only one that doesn't appear to be defined in this code.

In the future, when posting code, please use [code] tags.
An example of posting VB.NET code would be:
[code=vbnet]
'My VB.NET Code pasted here
[/code]
Oct 18 '07 #14
I'm not sure what type of object your reader variable is.
It's the only one that doesn't appear to be defined in this code.

In the future, when posting code, please use [code] tags.
An example of posting VB.NET code would be:
Expand|Select|Wrap|Line Numbers
  1. 'My VB.NET Code pasted here
  2.  
reader to read

i want to know if anybody can understand what i want and help me or no
Oct 18 '07 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
6
by: dbuchanan | last post by:
I have a Windows Forms application that accesses SQL Server 2k from a small local network. The application has been used for weeks on other systmes but a new install on a new machine retruns...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.