mutipe pages?

im trying to use a button to load a new page in the same window can someone give me some device

Answer this question

mutipe pages?

  • WII

    in vb 2005. im making a program that when you start it it has a window with just buttons in it. when you click one of the buttons the window will disply a new window. i need it to be just one window and not multiple windows when i cick the buttons on the first page
  • Amde

    Hi,

    I think this user is after using a Panel for controls instead of a new Form so that everything stays on one FORM or 'window' as Timmy0614 puts it.

    Unless you can have a child Form within a Form

    Like a child scrollable window within a HTML browser.

    Regards,

    S_DS



  • syhzaidi

    spiderman has got it. but i need help w/the coding. i have 2 forms form 1 has a button hat when clicked will open form 2 but also close form 1
  • Vlad Shimov

    ok that works except it opens a new window and i need it to refresh the window
  • AdrianG

    What's a page What device


  • vanu

    Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim f1 As New Form1
    f1.StartPosition = FormStartPosition.Manual
    f1.Location = Me.Location
    f1.Size = Me.Size
    f1.WindowState = Me.WindowState
    f1.Show()
    Me.Close()
    End Sub
    End Class

    Project + properties, Application tab, scroll down, Shutdown mode = "When last form closes".


  • Chimme

    Try this:

    Public Class Form1
    Private mForm2 As Form2
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If mForm2 Is Nothing Then
    '--- Form doesn't yet exist, create a new one
    mForm2 = New Form2
    AddHandler mForm2.FormClosed, AddressOf Form2_Closed
    mForm2.Show(Me)
    End If
    mForm2.Focus()
    End Sub
    Private Sub Form2_Closed(ByVal sender As Object, ByVal e As FormClosedEventArgs)
    mForm2 = Nothing
    End Sub
    End Class



  • febwave

    ok that still opens a new window. i need everything to stay in one window
  • Wayne.C

    Just close the existing one and create a new one:

    Public Class Form1
    Private mForm2 As Form2
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If mForm2 IsNot Nothing Then mForm2.Close()
    mForm2 = New Form2
    AddHandler mForm2.FormClosed, AddressOf Form2_Closed
    mForm2.Show(Me)
    End Sub
    Private Sub Form2_Closed(ByVal sender As Object, ByVal e As FormClosedEventArgs)
    mForm2 = Nothing
    End Sub
    End Class



  • dbaf

    sorry i dont know any of the technical terms. the last class i tokk was three years go
  • mutipe pages?