11-Linking Forms

0
301

This Visual Basic tutorial is all about Linking Forms.
How to link multiple Forms? Linking form to another is not a major technical problem for most programmers who have been working without default instances of non-form classes for so long. If you are used to building Windows applications using Visual basic, well it’s a big change. This change is that you need to have a reference to a particular instance of a form for you to be able to use it.

 

This is the example on how to link a Fom:
Open Visual basic 2008 and create a new Windows Form Application. After that, select a Button in the toolbox and drag it into the form. Change the text property of a Button into “Show Form2”.

lForm1

Click the solution explorer and right click the Windows Application that you have created. Select “add” and choose “Windows Form” to add another form.

lForm2

The dialog of Add New Item will then appear. Do the process just like the figure shown below.

lForm3

Now, you already have two Forms in the windows application. Go back to the form1 and double click the button to fire the click event handler of it and do the following code.

  1. Form2.Show()

This is how you link a form to another form.

 

The code in the view code will look like this.

  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Form2.Show()
  3. End Sub

 

Readers might read also:

 

Facebook Comments
(Visited 24 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here