CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Posts
    6

    How do we link two forms

    Hi,
    I am a new user to VB.Net,i have worked previously with VB 6.In that we give (for egform1.show to show a form and to hide we give form2.hide.How do we do this in VB.Net.I tried form1.activeform.show and hide but it is not working.

  2. #2
    Join Date
    Apr 2005
    Location
    India
    Posts
    271

    Smile Re: How do we link two forms

    Dear kaarthik,

    add to forms to your project form1 and form2

    in form1 add 2 buttons

    in the form1's general declaration section add this line of code

    Dim ff As New Form2

    Now add the below given code to the two buttons click events

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    'Show the form object of form2 named ff
    ff.Show()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    'Hide the form object of form2 named ff
    ff.Hide()
    End Sub

    Pramod S Nair
    Learn by Sharing.

    You can use some free things i have done from www.wisdombay.com

  3. #3
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: How do we link two forms

    Quote Originally Posted by kaarthik
    Hi,
    I am a new user to VB.Net,i have worked previously with VB 6.In that we give (for egform1.show to show a form and to hide we give form2.hide.How do we do this in VB.Net.I tried form1.activeform.show and hide but it is not working.
    Take a look at Using Multiple Forms in VB.NET This article will make life easier when working in VB.NET

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured