?
Solved

VBA vs VB

Posted on 2005-03-10
4
Medium Priority
?
212 Views
Last Modified: 2010-05-02
Hello ,
             I am making my first steps in VB and thare are things completely different from VBA. In VBA I was able to run a module's code without a form incorporated. In vb , on the other hand, I see that a form is a must - any code has to start with a form with a control on it. Correct me if I'm wrong.

            Another issue is handling the forms. This aspect is also different in VB.  For examle, I a got a form1 with button1 that starts sub1. Within sub1 I load, by show method, another form, form2, that has a listbox1 on it. I have to chose an option from that listbox and click button2 on form2 to continue sub1 with the option chosen in mind. The problem is, when I call form2 all the controlls on it have no focus as form1 was still holding it . form1 persists and I am unable to close it. Can you please help me with these issues?

Thanks a lot!
0
Comment
Question by:Autofreak
[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
  • 2
  • 2
4 Comments
 

Author Comment

by:Autofreak
ID: 13511381
OK, I partially solved the mistery,
               Now I called form2 with form2.show and what happens now I don't understand. VBA would give full control to the code in the form2 and wait for an event such as a button click to procede. Here execution goes two ways.  when I do F8, after form2.show is executed the form shows but the yellow  execution line goes to the next line in sub1 without wating for the results from manipulating the form. Form1 is also enabled but how I manipulate the controls on it does not affect the remaining  execution of sub1.  
0
 
LVL 5

Accepted Solution

by:
Rubyn earned 500 total points
ID: 13511407
You can use form2.show(vbModal) for waiting
0
 
LVL 5

Expert Comment

by:Rubyn
ID: 13511572
You can create vb application without form also. Set the project startup as "Sub Main" from Project Options. Create a new module and place a new procedure called Main
Public Sub Main
Msgbox "Test"
End Sub
now this will the entry point for the application. :)
0
 

Author Comment

by:Autofreak
ID: 13513756
Thanks a lot Rubyn!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

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