PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Application initialization event?

Reply

Application initialization event?

 
Thread Tools Rate Thread
Old 02-06-2005, 04:59 PM   #1
Mark Peters
Guest
 
Posts: n/a
Default Application initialization event?


I need to program a one-time application initialization event for a windows
form app, similar to what one might do in global.asa were one programming a
web app.

Our scenario is that we are using .NET remoting with a Win32 client to a
remote HTTP server. I need to invoke the remoting.config file once per user
session. Were this a web app, we would simply program Application_OnStart
as follows:

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

RemotingConfiguration.Configure(HttpContext.Current.Request.PhysicalApplicat
ionPath & "\remoting.config")

End Sub


Is there an equivalent global event for Win32? Which files do I have to add
to my Win32 client project?

TIA.
mark



  Reply With Quote
Old 02-06-2005, 07:19 PM   #2
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
Default Re: Application initialization event?

"Mark Peters" <mcpdoc@hotmail.com> schrieb:
>I need to program a one-time application initialization event for a windows
> form app, similar to what one might do in global.asa were one programming
> a
> web app.


Add this code to a module file and select 'Sub Main' as startup object in
the project properties:

\\\
Public Module Program
Public SubMain(ByVal Args() As String)
For Each Arg As String In Args
Console.WriteLine(Arg)
Next Arg
End Sub
End Module
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

  Reply With Quote
Old 04-06-2005, 12:50 AM   #3
Stoitcho Goutsev \(100\) [C# MVP]
Guest
 
Posts: n/a
Default Re: Application initialization event?

Execution of winforms applications is straightforward. There more than one
places where you can put your initialization code:
1. In the main method, before Application.Run method code
2. In the main form costructor
3. Handling Form.Load event (or alternatively overriding Form's OnLoad
virtual method)



--
Stoitcho Goutsev (100) [C# MVP]

"Mark Peters" <mcpdoc@hotmail.com> wrote in message
news:O07ARw4ZFHA.3096@TK2MSFTNGP15.phx.gbl...
>I need to program a one-time application initialization event for a windows
> form app, similar to what one might do in global.asa were one programming
> a
> web app.
>
> Our scenario is that we are using .NET remoting with a Win32 client to a
> remote HTTP server. I need to invoke the remoting.config file once per
> user
> session. Were this a web app, we would simply program Application_OnStart
> as follows:
>
> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
>
> RemotingConfiguration.Configure(HttpContext.Current.Request.PhysicalApplicat
> ionPath & "\remoting.config")
>
> End Sub
>
>
> Is there an equivalent global event for Win32? Which files do I have to
> add
> to my Win32 client project?
>
> TIA.
> mark
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off