Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Realoading a VB app

Status
Not open for further replies.

toon10

Programmer
Mar 26, 2004
303
DE
Quick question.

Is there a way to restart your application in code? After a data import routine, I want a datacombo box to reflect the extra data added to it. Nothing seems to work (not even running the Form_Load event again) so I thought if I could unload the app and then reload it, it would solve my problems.

Thanks
Andrew
 
if you are sure there is no other way to do this. ( I Haven't seen your code so I don't know what you've tried )

but this is how you do what you ask us how to do : restart your vb app.

Private Sub Command1_Click()
Unload Me
Shell App.Path & "\" & App.EXEName & ".exe"
End Sub

REMEMBER that this piece of code will only work when you have compiled the application and there is an exe of that application available. THIS IS NOT A VERY EFFICIENT WAY OF DOING THIS.
IF YOU MAIL ME OF POST YOUR CODE I'LL TRY TO FIX IT FOR YOU.
 
I have datacombo bound to a data designer command. This works fine. I have an import routine which reads in a text file. The issue I have is that when I click the combo box after the data import, the newly added records don't appear. If I close the app and then start it again, they appear in the combo box.

I have tried using the .refill and .refresh methods but they don't seem to do anything. I have also tried to rebind the data using code but it doesn't like that either.

I don't think your code will work as once the Unload me statement has been fired, the control will end and the shell statement will never get triggered.

Private Sub Command1_Click()
Unload Me
Shell App.Path & "\" & App.EXEName & ".exe"
End Sub

Thanks
Andrew
 
The Code post is allways tried and tested.
I have never posted code that i "Think" will work.
Just write a small app with 1 command button and test it for yourself.
I KNOW it works.
Or just put a msgbox after the unload me statement. the msgbox will also fire off.
I use this when asking a user if they really want to exit the prog cause files isn't saved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top