Hi all I am working on an application in vb.net which requires to check an instance of application before loadin the main form Can any one help me to know if there is any form event that’ll run before Form_load The check i need to perform will not work if given in Form_load event. so i need to give it before form_load event. Also is there any way i can check that an instance of application is already running thanks
in vb.net
’ Visual Basic .NET
Function PrevInstance() As Boolean
If
Ubound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName))
0 Then
Return True
Else
Return False
End If
End Function
in VB6
app. PrevInstance
use this in sub main
From: “pradeep via vb-dotnet-l”
Hi pradeep
It has solved my probs
Thank you
Hi
Yes u can do that
Make a module and add a sub as Sub Main
In the project properties, in Startup Object u will have that “Sub Main”
Select it, the exe will first run the Sub Main of that module
The way u r going around doesnt solves your purpose
Try thru module Sub Main
I am already using it in my live project
Regards
Pradeep
Hi
But can module be directly given as startup object ?
I tried givin it in a seperate form(frmStart) jus for startup checkin
condition
But then this form(frmStart) will pop up afer application has loaded which i
diont want to happen inspite of givin it hide & visibilty false
thanks & regards
Hi
Well…the functionality that u r asking for can be handled like this
- Make a module
- Make the module as the startup
- Apply what ever logics u want to apply before starting the main form
- Call the Application.Run(New