Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

VBA vs VB

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
Autofreak
Asked:
Autofreak
  • 2
  • 2
1 Solution
 
AutofreakAuthor Commented:
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
 
RubynCommented:
You can use form2.show(vbModal) for waiting
0
 
RubynCommented:
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
 
AutofreakAuthor Commented:
Thanks a lot Rubyn!!
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!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now