Sunday, November 14, 2010

How to make a form come before another form in VB?

for example if you have form 1, form 2, and form 2, and when the program is run it runs form 1, form 2, form 3. in that order. how could you change it so that for example form 2 if loaded first then 1 then 3.How to make a form come before another form in VB?
if you use visual basic 2008, just like me, then do the following:



first go to project (wich is in the visual basic menubar, 4th item)



then select the most downword tab: ''aplication name'' properties



now you get a bunch of things, at the first tab u see: application, make sure to be on that one. there you see ''startup form'', select form 2, and it will load form 2 first...



good luck! :)How to make a form come before another form in VB?
The other answer is correct. You set the load form in the project. However, if you are not sure what form should be loaded you would have to do it by code.



Lets say that a form shows if a user is running xp you want form 1 to load, if windows 7 form 3 to load. You can make a module with a public sub Main that would be ran with something like



public sub Main

dim f as form

if (whatever) then

f=new form1

else

f=new form2

end if



fm.show

end sub



then use that as your startup.



I think that vb 2008 hates this though.

No comments:

Post a Comment