Solved

Windows Forms in Visual Basic

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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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