vb.net form won't save value
Posted on 2006-07-18
I have a form that I open up to get a file name to save to.
Pretty much, it is just a text box with a few buttons.
On the form, I have a variable
Public saveName As String
I have a save button which puts the textbox.text into the variable above
Private Sub BtnSaveAs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSaveAs.Click
If Trim(txtSaveAs.Text) = "" Then
MsgBox("You must enter a name first")
saveName = txtSaveAs.Text
canceled = False
Me.Visible = False
The main form that calls the second form, then asks the value of the textbox.
Public Function getText() As String
getText = Trim(saveName)
For some reason, when the main function calls getText, the value of saveName is nothing.
I got rid of the me.hide because I though that was the reason.