Application exiting before doing what it should do

J

John

Hi

My app involves an Infragistics control but as problem seems to be more with
how vb.net works when using SUB Main so I am posting it here nevertheless. I
want my app to pick up the first command line argument, pass it to
infragistics desktop alert control to display and then exit. My code is
given below. Problem is that app exits as soon as it is run and desktop
alert does not get time to be displayed. However the same alert displays
fine if I use start-up form (instead of SUB Main) and use a button on form
to run the ShowDesktopAlert SUB.

What is the problem and how can I make it work using SUB Main?

Thanks

Regards


Module modMain
Friend WithEvents dalMain As New Infragistics.Win.Misc.UltraDesktopAlert

Sub Main(ByVal sArgs() As String)
Dim Tel As String = ""
Dim Caption As String = ""

If sArgs.Length > 0 Then
Tel = sArgs(0)
Caption = "Incoming Staff call " & Tel
ShowDesktopAlert(Caption, "Goto contact?")
End If
End Sub

Sub ShowDesktopAlert(ByVal Caption As String, ByVal Msg As String)
dalMain.Show(Caption & ":" & Msg, "Click here to go to contact
record.")
Application.DoEvents()
End Sub

End Module
 
A

Armin Zingler

John said:
Sub ShowDesktopAlert(ByVal Caption As String, ByVal Msg As
String)
dalMain.Show(Caption & ":" & Msg, "Click here to go
to contact record.")
Application.DoEvents()
End Sub

End Module

Is dalMain a Form? If it is, replace
application.doevents
with
application.run(dalMain)

This makes the app close after dalMain has been closed. If it's not a
Form...(taken from their homepage it seems to be a component)..., you should
call Application.Run() without args. Then, call Application.ExitThread
whenever you want the app to close.


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top