DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   student name and grade in file (http://www.daniweb.com/forums/thread160303.html)

bpacheco1227 Dec 1st, 2008 3:59 pm
student name and grade in file
 
I need to add student name and grade to a file.
This is my section of code so far
Private Sub addStudentNameGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addStudentNameGrade.Click
        Dim swrStreamWriter As IO.StreamWriter
        swrStreamWriter = IO.File.AppendText(path & "studentgrade.txt")
        swrStreamWriter.WriteLine(Me.textStudent.Text, " ", Me.textGrade.Text)
        'swrStreamWriter.WriteLine(Me.textGrade.Text)
        swrStreamWriter.Close()
    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 "

markd220 Dec 1st, 2008 4:50 pm
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.

bpacheco1227 Dec 2nd, 2008 10:33 am
Re: student name and grade in file
 
cool thank you, I forgot about concatenation


All times are GMT -4. The time now is 1:31 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC