943,786 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 531
  • VB.NET RSS
Dec 1st, 2008
0

student name and grade in file

Expand Post »
I need to add student name and grade to a file.
This is my section of code so far
VB Syntax (Toggle Plain Text)
  1. Private Sub addStudentNameGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addStudentNameGrade.Click
  2. Dim swrStreamWriter As IO.StreamWriter
  3. swrStreamWriter = IO.File.AppendText(path & "studentgrade.txt")
  4. swrStreamWriter.WriteLine(Me.textStudent.Text, " ", Me.textGrade.Text)
  5. 'swrStreamWriter.WriteLine(Me.textGrade.Text)
  6. swrStreamWriter.Close()
  7. End Sub

I know the problem is with this line " swrStreamWriter.WriteLine(Me.textStudent.Text, " ", Me.textGrade.Text) " . I'm not sure how to show in the file "textStudent textGrade". Need to write, in a file student then grade on the same line, eg. " Brandon 70 "
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
bpacheco1227 is offline Offline
58 posts
since Jul 2007
Dec 1st, 2008
1

Re: student name and grade in file

You want to make both texts one string and write that to the file.

swrStreamWriter.WriteLine(Me.textStudent.Text + " " + Me.textGrade.Text)

Also research the VB.Net String Functions for further reading.
Last edited by markd220; Dec 1st, 2008 at 4:52 pm.
Reputation Points: 14
Solved Threads: 2
Newbie Poster
markd220 is offline Offline
10 posts
since Nov 2008
Dec 2nd, 2008
0

Re: student name and grade in file

cool thank you, I forgot about concatenation
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
bpacheco1227 is offline Offline
58 posts
since Jul 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: create dll using vb.net and how to call it from sql server
Next Thread in VB.NET Forum Timeline: create a .cab file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC