?
Solved

Forms

Posted on 2006-07-13
9
Medium Priority
?
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 86

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 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

764 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