I'm pretty damn new to programming, but I have a basic understanding of the concepts. Right now though, I'm really struggling to update the text of a textbox on Form2 with a button on Form1 (names changed for ease of understanding).
Form1 and Form2 are both declared as Public Shared forms.
Form1 creates Form2 with this code:
In Form2, I created Textbox1 and set the Modifiers property to Public.
I know I can read the text from Form2.Textbox1.Text from Form1, because my first test with the button was:
And the MessageBox correctly displays whatever is in the textbox. However, I'm running into trouble adding text to the textbox with that button. My code for that is simpe:
When I click the button, nothing happens in the textbox. Can anybody tell me what I'm doing wrong? Thanks.
Form1 and Form2 are both declared as Public Shared forms.
Form1 creates Form2 with this code:
VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim NewForm1 As New Form2()
NewForm1.Show()
End Sub
In Form2, I created Textbox1 and set the Modifiers property to Public.
I know I can read the text from Form2.Textbox1.Text from Form1, because my first test with the button was:
VB.NET:
Private Sub btnTest_Click(ByVal sender As System.Object,_
ByVal e As System.EventArgs) Handles btnTESTFindFight.Click
MessageBox.Show(Form2.Textbox1.Text)
End Sub
And the MessageBox correctly displays whatever is in the textbox. However, I'm running into trouble adding text to the textbox with that button. My code for that is simpe:
VB.NET:
Private Sub btnTest_Click(ByVal sender As System.Object,_
ByVal e As System.EventArgs) Handles btnTESTFindFight.Click
Form2.Textbox1.Text = "TEST"
End Sub
When I click the button, nothing happens in the textbox. Can anybody tell me what I'm doing wrong? Thanks.
Last edited: