excute code from form2 in form 1
So i am trying to make a basic title screen and have made two form2 form 1 has all of the controll to start game go to instuctions (ect) form 2 has a text box that will display some of the working of what is going on in the game and has text inside the text box.
What i am trying to do is after form 1 get through its code ... ( you click a button and it hides form 1 and shows form 2)... i want it to execute form2 code which is a sub prosedure that alligns the text to center in text box1.
This is my code so far:
CODE for form 1:
Public Class Form1
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Form2.Show()
Me.Hide()
End Sub
End Class
CODE for form 2:
Public Class Form2
Sub alligntext()
RichTextBox1.Text = HorizontalAlignment.Center
End Sub
End Class
Re: excute code from form2 in form 1
You'll want to write a routine for the Form2_Load event. You can access this event easily by double-clicking on form2 in the form2 designer.
Re: excute code from form2 in form 1
Read the Forms in VB.NET tutorial in my signature.
Re: excute code from form2 in form 1
which one the home and learn because there are so many in your signature .... :) ><
Re: excute code from form2 in form 1
Knock, knock. ;)
Quote:
Originally Posted by jmcilhinney
Read the Forms in VB.NET tutorial in my signature.