navigate between forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Mastracchio

    navigate between forms

    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.redire ct ("formb") equivilent for win app.
    Thanks



  • Cor Ligthert

    #2
    Re: navigate between forms

    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_VisibleCha nged(ByVal sender As Object, _
    ByVal e As System.EventArg s) Handles frm2.VisibleCha nged
    If frm2.inputfield <> "" Then
    Me.Show()
    Me.Label1.Text = frm2.inputfield
    frm2.Dispose()
    End If
    End Sub
    Private Sub frm3_VisibleCha nged(ByVal sender As Object, _
    ByVal e As System.EventArg s) Handles frm3.VisibleCha nged
    If frm3.inputfield <> "" Then
    Me.Show()
    Me.Label1.Text = frm3.inputfield
    frm3.Dispose()
    End If
    End Sub

    Private Sub Form1_Load(ByVa l sender As Object, _
    ByVal e As System.EventArg s) 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(B yVal sender As System.Object, _
    ByVal e As System.EventArg s) Handles Button1.Click
    inputfield = "sometext"
    Me.Hide()
    End Sub
    ///


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: navigate between forms

      * "Tony Mastracchio" <TonyMast@MSN.C om> scripsit:[color=blue]
      > Win app vs vb .net xp pro
      > I have 2 forms
      > forma and formb
      > how do I show formb from a button on forma.[/color]

      <URL:http://groups.google.d e/groups?selm=%23 HRMBHBRDHA.2204 %40TK2MSFTNGP12 .phx.gbl>

      --
      Herfried K. Wagner [MVP]
      <URL:http://dotnet.mvps.org/>

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: navigate between forms

        * "Tony Mastracchio" <TonyMast@MSN.C om> scripsit:[color=blue]
        > 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.redire ct ("formb") equivilent for win app.[/color]

        <URL:http://groups.google.d e/groups?selm=%23 HRMBHBRDHA.2204 %40TK2MSFTNGP12 .phx.gbl>

        --
        Herfried K. Wagner [MVP]
        <URL:http://dotnet.mvps.org/>

        Comment

        Working...