carry values across forms

G

gordon

Hi,

I have a series of forms that collect information from a user. When I write
out my information to a text file after the last file, the values of the
previous forms seem to be blank. I would like to retain the values of
names.textbox1.text and names.textbox2.text for the output file.

Any help greatly appreciated.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

TextBox1.Focus()

Dim names As New Names

Dim sw As New IO.StreamWriter(filer, True) ' True means append

Dim strName As String = names.TextBox1.Text

Dim strValue As String = names.TextBox2.Text

Dim today As Date = Now()

Dim strdate As String = today.ToString("d")

Dim golfScore As String = TextBox1.Text

sw.WriteLine(String.Format("{0},{1},{2},{3}", strName, strValue, strdate,
golfScore))

sw.Flush()

sw.Close()



names.Show()

Me.Hide()

End Sub
 
W

Walter Clayton

This really isn't the proper forum, however...

Just as a hint, your problem lies here:
Dim names As New Names

You're creating a new instance of the object and not overriding default
initialization values. You should be able to figure it from there. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top