Solved

Windows Forms in Visual Basic

Posted on 2011-09-06
4
413 Views
Last Modified: 2013-11-27
I want to create a button in Form 1 that will open up Form 2 in Windows Application. I have the button on the form already but can't get Form 2 to open up.
0
Comment
Question by:lovemycomputers
4 Comments
 
LVL 4

Expert Comment

by:Daelt
ID: 36487595
Did you try this? :

Private Sub cmdPoste_Click()
    DoCmd.OpenForm "Form2"
End Sub

Open in new window

0
 
LVL 1

Accepted Solution

by:
adamlonsdale earned 500 total points
ID: 36487928
Double click the button on your form to show the code view. You should enter the following code

Dim frm as new Form2
frm.Show

Open in new window

0
 
LVL 40
ID: 36490107
Forms do not come automatically in VB now. You need to create a variable in order to use a form.

I suggest that you get use to that way of working, because it gives lot a better control of what is happening in the application.

If you are in a rush of simply an amateur programmer however, you can work as you did before by using the following syntax:

My.Forms.Form2.Show
My.Forms.FormAnything.Show
My.Forms.FormAnother.Show
0
 
LVL 2

Expert Comment

by:JAVI1065
ID: 36498731

Dim myvariable as new Myform()

myvariable.show()
or
myvariable.showdialog() "for modal open"
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now