?
Solved

Windows Forms in Visual Basic

Posted on 2011-09-06
4
Medium Priority
?
421 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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 …
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

800 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