M
mgoold2002
Here is the offending excerpt from my code. I just began trying to
port some vb code I'd written into my first .NET app.
Public Class bannergenerator 'THIS IS AN ORDINARY WINDOWS FORM
Inherits System.Windows.Forms.Form
Friend strINPUTFILE 'STRING TO HOLD INPUT FILE NAME
Public objOpenfile
<..code defining the form>
'THIS IS CODE THAT OPENS AN OPEN FILE DIALOGUE WHEN YOU CLICK A BUTTON,
'STORES THE SELECTED FILE INTO A TEXT BOX,
'AND IS SUPPOSED TO STORE IT INTO A STRING "strINPUTFILE" as well
Sub btnSelect_Inputs_File_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSelect_Inputs_File.Click
Dim objOpenfile As New OpenFileDialog
objOpenfile.Multiselect() = False
If objOpenfile.ShowDialog = DialogResult.OK Then
tboxSelectInputs.Text = objOpenfile.FileName 'tranfer the
selected file name to a text box
strINPUTFILE = tboxSelectInputs.Text
End If
End Sub
End Class
My problem with the above code is that the "strINPUTFILE" variable does
not appear to be receiving the value from "tboxSelectInputs.Text",
although "tboxSelectInputs.Text" is finding the correct selected file
value. Also, the "strINPUTFILE" variable shows up as undeclared when
it is referenced in another module in the same project, although I've
declared it a Friend outside of any sub in its class. What don't I
understand?
Best regards and thanks for any help.
port some vb code I'd written into my first .NET app.
Public Class bannergenerator 'THIS IS AN ORDINARY WINDOWS FORM
Inherits System.Windows.Forms.Form
Friend strINPUTFILE 'STRING TO HOLD INPUT FILE NAME
Public objOpenfile
<..code defining the form>
'THIS IS CODE THAT OPENS AN OPEN FILE DIALOGUE WHEN YOU CLICK A BUTTON,
'STORES THE SELECTED FILE INTO A TEXT BOX,
'AND IS SUPPOSED TO STORE IT INTO A STRING "strINPUTFILE" as well
Sub btnSelect_Inputs_File_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSelect_Inputs_File.Click
Dim objOpenfile As New OpenFileDialog
objOpenfile.Multiselect() = False
If objOpenfile.ShowDialog = DialogResult.OK Then
tboxSelectInputs.Text = objOpenfile.FileName 'tranfer the
selected file name to a text box
strINPUTFILE = tboxSelectInputs.Text
End If
End Sub
End Class
My problem with the above code is that the "strINPUTFILE" variable does
not appear to be receiving the value from "tboxSelectInputs.Text",
although "tboxSelectInputs.Text" is finding the correct selected file
value. Also, the "strINPUTFILE" variable shows up as undeclared when
it is referenced in another module in the same project, although I've
declared it a Friend outside of any sub in its class. What don't I
understand?
Best regards and thanks for any help.