navigate between forms

  • Thread starter Thread starter Tony Mastracchio
  • Start date Start date
T

Tony Mastracchio

Win app vs vb .net xp pro
I have 2 forms
forma and formb
how do I show formb from a button on forma.
kinda like
response.redirect ("formb") equivilent for win app.
Thanks
 
Hi Tony,

In windows forms there are a lot of methods, maybe is the webform equivalent
more enclosed in the form.showdialog, however I give you beneath a sample I
once made from 3 constantly active forms and using the visible event to show
them, in my idea something a little bit the same as with aspnet.

However again, this is one method, in winforms you can use a lot of them.
And keep in mind. When the data is global the data is persistent on all
three forms, that is also for a shared class which belongs to the client
(also the application but that is from the client).

I hope this helps?

Cor

\\\form1
Private WithEvents frm3 As New Form3
Private WithEvents frm2 As New Form2
Private Sub frm2_VisibleChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles frm2.VisibleChanged
If frm2.inputfield <> "" Then
Me.Show()
Me.Label1.Text = frm2.inputfield
frm2.Dispose()
End If
End Sub
Private Sub frm3_VisibleChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles frm3.VisibleChanged
If frm3.inputfield <> "" Then
Me.Show()
Me.Label1.Text = frm3.inputfield
frm3.Dispose()
End If
End Sub

Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
frm3.Show()
frm3.TopLevel = True
frm2.Show()
frm2.TopLevel = True
End Sub
///
\\\form and 3 the same form2 and form3
Public inputfield As String
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
inputfield = "sometext"
Me.Hide()
End Sub
///
 
Back
Top