Connecting Tech Pros Worldwide Forums | Help | Site Map

Create my own window

Gary Owsiany
Guest
 
Posts: n/a
#1: Nov 20 '05
Until now I have been using the default "windows application" template to
create a new window. What I would like to do is play with dynamic window
creation. However, when I just create a class that contains sub Main() it
doesn't want to compile in the IDE. Is there some property I need to set?
The code below is what I want to use to create my window class. How can I
do it within the VisualStudio IDE?
Thanks,
Gary O.

Public Shared Sub Main()

Dim form1 As New Form

Dim form2 As New Form

form1.Text = "Form passed to Run()"

form2.Text = "Second form"

form2.Show()

Application.Run(form1)

MessageBox.Show("Application.Run() has returned " & _

"control back to Main. Bye, Bye!", "Two Forms")

End Sub



Armin Zingler
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Create my own window


"Gary Owsiany" <gar-car@swbell.net> schrieb[color=blue]
> Until now I have been using the default "windows application"
> template to create a new window. What I would like to do is play
> with dynamic window creation. However, when I just create a class
> that contains sub Main() it doesn't want to compile in the IDE.[/color]

Why? Error message? Which project type did you choose (Windowsapplication,
consoleapplicatoin or classlibrary)?
[color=blue]
> Is
> there some property I need to set? The code below is what I want to
> use to create my window class. How can I do it within the
> VisualStudio IDE? Thanks,
> Gary O.
>
> Public Shared Sub Main()
>
> Dim form1 As New Form
>
> Dim form2 As New Form
>
> form1.Text = "Form passed to Run()"
>
> form2.Text = "Second form"
>
> form2.Show()
>
> Application.Run(form1)
>
> MessageBox.Show("Application.Run() has returned " & _
>
> "control back to Main. Bye, Bye!", "Two Forms")
>
> End Sub[/color]

The code looks fine. What did you choose as the startup object in the
project properties?


--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Create my own window


* "Gary Owsiany" <gar-car@swbell.net> scripsit:[color=blue]
> Until now I have been using the default "windows application" template to
> create a new window. What I would like to do is play with dynamic window
> creation. However, when I just create a class that contains sub Main() it
> doesn't want to compile in the IDE. Is there some property I need to set?
> The code below is what I want to use to create my window class. How can I
> do it within the VisualStudio IDE?[/color]

\\\
Public Class AppMain
///
[color=blue]
> Public Shared Sub Main()
>
> Dim form1 As New Form
>
> Dim form2 As New Form
>
> form1.Text = "Form passed to Run()"
>
> form2.Text = "Second form"
>
> form2.Show()
>
> Application.Run(form1)
>
> MessageBox.Show("Application.Run() has returned " & _
>
> "control back to Main. Bye, Bye!", "Two Forms")
>
> End Sub[/color]

\\\
End Class
///

In the project properties dialog set 'AppMain' as startup object.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Closed Thread