Solved

Windows Forms in Visual Basic

Posted on 2011-09-06
4
416 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

17 Experts available now in Live!

Get 1:1 Help Now