Solved

Forms

Posted on 2006-07-13
9
250 Views
Last Modified: 2010-04-23
I have no idea how create a button and tell the button to pull up another form. What is the command. Thanks!
0
Comment
Question by:steverpayne
9 Comments
 
LVL 6

Expert Comment

by:carmodyk
ID: 17103127
Dim objForm As frmNewForm
        objForm = New frmNewForm
        objForm.Owner = Me
        objForm.ShowDialog()
        objForm.Dispose()
0
 

Author Comment

by:steverpayne
ID: 17103202
is this in visual basic .net express 2005?
0
 
LVL 6

Expert Comment

by:carmodyk
ID: 17103238
Sorry, let me be more specific:  Place a button on your form from the toolbox.  Double click the button, which will take you to the code for the button.  Place the following code in your subroutine for the button and it should look like this:

Private Sub Yourbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles YourButton.Click
      Dim objForm As frmNewForm
        objForm = New frmNewForm
        objForm.Owner = Me
        objForm.ShowDialog()
        objForm.Dispose()
End Sub
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 6

Expert Comment

by:carmodyk
ID: 17103244
I did code this in VB.NET 2003, but I don't think it should matter.  If it does, let me know.
0
 
LVL 10

Expert Comment

by:gangwisch
ID: 17103712
sub button1_click
dim a as new form2
a.show
me.hide 'optional
end sub
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 17105914
In VB.Net 2005, you can use the "default instance" of forms just like you did in VB6.  This is useful for when you only want ONE instance of each form available.

Instead of creating a new instance as shown above, you simply use the forms name:

    Private Sub Button1_Click(...) Handles Button1.Click
        SomeForm.Show()
    End Sub

You can use "SomeForm" from anywhere in the application to refer to the default instance.

If you want more than one instance of "SomeForm" then do as above and create new instances with the "new" keyword.
0
 

Author Comment

by:steverpayne
ID: 17155937
this is what the button looks like. Now where do i insert that i want it to open or close the form?


 Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

    End Sub
End Class
0
 
LVL 6

Accepted Solution

by:
carmodyk earned 50 total points
ID: 17156904
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
 Dim objForm As frmNewForm
        objForm = New frmNewForm
        objForm.Owner = Me
        objForm.ShowDialog()
        objForm.Dispose()
  End Sub

What this will do is create a new instance of the form you want to open, and it will keep the form open all to itself, until the user closes it.  Try it out, see if you like it.
0
 

Author Comment

by:steverpayne
ID: 17175312
thank you it was very simple at the code that you provided. Since I am new and taking a class, i am new at this. Thanks!
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Single Form 8 42
.NET tools for adding thread safety to a web app? 3 35
How to retrieve a mysql date column that has 0000-00-00 in vb.net 8 36
VB.NET 1 24
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question