473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what did I miss?

jg
I setup a new windwos application project but I found out the sub main was
not called, I tried various form of Main (functions, subs) still no luck.
What did I miss?

Public Class SolverForm
Dim icnt_pieces = 0, iCurrent_Row = 0, iExpected_piece s = 16, i As
Integer
Dim ipb_piece() As PictureBox
Dim str_label() As String
Dim chr_Atrribute(i Expected_pieces )() As Char
Dim chr_AtrributeFl ip(iExpected_pi eces)() As Char
Dim b_used() As Boolean

Dim ipb_origin_loca tion As System.Drawing. Point
Dim ipb_origin_offs et As Integer = 106

Const CSTR_LABEL As String = "ABCDEFGHIJKLMN OPQRSTUVZ012345 6789"

Public Function Main(ByVal cmdArgs() As String) As Integer

MsgBox("MAIN - before new Game", MsgBoxStyle.Inf ormation, "@debug") ' never
appear
NewGame()
ipb_piece(0) = PictureBox1
ipb_piece(1) = PictureBox2
ipb_piece(2) = PictureBox3
ipb_piece(3) = PictureBox4
......
ipb_piece(15) = PictureBox16
MsgBox("MAIN - before calling rect", MsgBoxStyle.Inf ormation,
"@debug")
testRectangle()

End Function
Jan 3 '06 #1
7 1212
"jg" <ju**@mail.pl s> schrieb
I setup a new windwos application project but I found out the sub
main was not called, I tried various form of Main (functions, subs)
still no luck. What did I miss?

[...]

Public Function Main(ByVal cmdArgs() As String) As Integer


Shared function Main...
And set it as the startup object in the project properties.
Armin
Jan 3 '06 #2
As Armin suggested, you need to make Maim shared but if you do it in place
it will cause other problems. Add a Form_Load event handler to SolverForm,
copy all the code from Main to Form_Load and delete Main then add this
class:

Public Class AppStart
Public Shared Sub Main()
Application.Run (New SolverForm())
End Sub
End Class

Then, set the startup object to AppStart.Main

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/
"jg" <ju**@mail.pl s> wrote in message
news:uN******** ******@TK2MSFTN GP14.phx.gbl...
I setup a new windwos application project but I found out the sub main was
not called, I tried various form of Main (functions, subs) still no luck.
What did I miss?

Public Class SolverForm
Dim icnt_pieces = 0, iCurrent_Row = 0, iExpected_piece s = 16, i As
Integer
Dim ipb_piece() As PictureBox
Dim str_label() As String
Dim chr_Atrribute(i Expected_pieces )() As Char
Dim chr_AtrributeFl ip(iExpected_pi eces)() As Char
Dim b_used() As Boolean

Dim ipb_origin_loca tion As System.Drawing. Point
Dim ipb_origin_offs et As Integer = 106

Const CSTR_LABEL As String = "ABCDEFGHIJKLMN OPQRSTUVZ012345 6789"

Public Function Main(ByVal cmdArgs() As String) As Integer

MsgBox("MAIN - before new Game", MsgBoxStyle.Inf ormation, "@debug") '
never appear
NewGame()
ipb_piece(0) = PictureBox1
ipb_piece(1) = PictureBox2
ipb_piece(2) = PictureBox3
ipb_piece(3) = PictureBox4
.....
ipb_piece(15) = PictureBox16
MsgBox("MAIN - before calling rect", MsgBoxStyle.Inf ormation,
"@debug")
testRectangle()

End Function

Jan 3 '06 #3
Hi,

Isn't it sub main to startup from not function main?

Ken
----------------
"Armin Zingler" <az*******@free net.de> wrote in message
news:OG******** ******@TK2MSFTN GP11.phx.gbl...
"jg" <ju**@mail.pl s> schrieb
I setup a new windwos application project but I found out the sub
main was not called, I tried various form of Main (functions, subs)
still no luck. What did I miss?
[...]

Public Function Main(ByVal cmdArgs() As String) As Integer


Shared function Main...
And set it as the startup object in the project properties.
Armin

Jan 3 '06 #4
"Ken Tucker [MVP]" <vb***@bellsout h.net> schrieb:
Isn't it sub main to startup from not function main?


It will work with a function 'Main(ByVal Args() As String) As Integer' too,
even inside VS.NET.

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

Jan 3 '06 #5
jg
thank you all very much. . I look up the form load declaration.

why constructor does not work instead of this extra complexity? After all
is not a window app a class by in its own right?
( pardon me I am used to languages with constructors)

"Rob Windsor [MVP]" <ro************ *****@gmail.com > wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
As Armin suggested, you need to make Maim shared but if you do it in place
it will cause other problems. Add a Form_Load event handler to SolverForm,
copy all the code from Main to Form_Load and delete Main then add this
class:

Public Class AppStart
Public Shared Sub Main()
Application.Run (New SolverForm())
End Sub
End Class

Then, set the startup object to AppStart.Main

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/
"jg" <ju**@mail.pl s> wrote in message
news:uN******** ******@TK2MSFTN GP14.phx.gbl...
I setup a new windwos application project but I found out the sub main was
not called, I tried various form of Main (functions, subs) still no luck.
What did I miss?

Public Class SolverForm
Dim icnt_pieces = 0, iCurrent_Row = 0, iExpected_piece s = 16, i As
Integer
Dim ipb_piece() As PictureBox
Dim str_label() As String
Dim chr_Atrribute(i Expected_pieces )() As Char
Dim chr_AtrributeFl ip(iExpected_pi eces)() As Char
Dim b_used() As Boolean

Dim ipb_origin_loca tion As System.Drawing. Point
Dim ipb_origin_offs et As Integer = 106

Const CSTR_LABEL As String = "ABCDEFGHIJKLMN OPQRSTUVZ012345 6789"

Public Function Main(ByVal cmdArgs() As String) As Integer

MsgBox("MAIN - before new Game", MsgBoxStyle.Inf ormation, "@debug") '
never appear
NewGame()
ipb_piece(0) = PictureBox1
ipb_piece(1) = PictureBox2
ipb_piece(2) = PictureBox3
ipb_piece(3) = PictureBox4
.....
ipb_piece(15) = PictureBox16
MsgBox("MAIN - before calling rect", MsgBoxStyle.Inf ormation,
"@debug")
testRectangle()

End Function


Jan 3 '06 #6
You can use the constructor if you want. People coming from a classic VB
background (like myself) are just used to putting the form initialization
code in the Load event.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/

"jg" <ju**@mail.pl s> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
thank you all very much. . I look up the form load declaration.

why constructor does not work instead of this extra complexity? After
all is not a window app a class by in its own right?
( pardon me I am used to languages with constructors)

"Rob Windsor [MVP]" <ro************ *****@gmail.com > wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
As Armin suggested, you need to make Maim shared but if you do it in
place it will cause other problems. Add a Form_Load event handler to
SolverForm, copy all the code from Main to Form_Load and delete Main then
add this class:

Public Class AppStart
Public Shared Sub Main()
Application.Run (New SolverForm())
End Sub
End Class

Then, set the startup object to AppStart.Main

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/
"jg" <ju**@mail.pl s> wrote in message
news:uN******** ******@TK2MSFTN GP14.phx.gbl...
I setup a new windwos application project but I found out the sub main
was not called, I tried various form of Main (functions, subs) still no
luck. What did I miss?

Public Class SolverForm
Dim icnt_pieces = 0, iCurrent_Row = 0, iExpected_piece s = 16, i As
Integer
Dim ipb_piece() As PictureBox
Dim str_label() As String
Dim chr_Atrribute(i Expected_pieces )() As Char
Dim chr_AtrributeFl ip(iExpected_pi eces)() As Char
Dim b_used() As Boolean

Dim ipb_origin_loca tion As System.Drawing. Point
Dim ipb_origin_offs et As Integer = 106

Const CSTR_LABEL As String = "ABCDEFGHIJKLMN OPQRSTUVZ012345 6789"

Public Function Main(ByVal cmdArgs() As String) As Integer

MsgBox("MAIN - before new Game", MsgBoxStyle.Inf ormation, "@debug") '
never appear
NewGame()
ipb_piece(0) = PictureBox1
ipb_piece(1) = PictureBox2
ipb_piece(2) = PictureBox3
ipb_piece(3) = PictureBox4
.....
ipb_piece(15) = PictureBox16
MsgBox("MAIN - before calling rect", MsgBoxStyle.Inf ormation,
"@debug")
testRectangle()

End Function



Jan 4 '06 #7
jg
Thank you.

how do I make sure what I do is after the form is fully created and loaded?
e.g I want to get hold of the list of picture boxes and have an array of
picture box to point to them. this way I can manipulate the content of the
picturebox a bit easier.
The load event seem to occur before completion. I tried searching for form
events for vb.net and I got overwhelming irrelevant results.

"Rob Windsor [MVP]" <ro************ *****@gmail.com > wrote in message
news:eo******** ******@TK2MSFTN GP12.phx.gbl...
You can use the constructor if you want. People coming from a classic VB
background (like myself) are just used to putting the form initialization
code in the Load event.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/

"jg" <ju**@mail.pl s> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
thank you all very much. . I look up the form load declaration.

why constructor does not work instead of this extra complexity? After
all is not a window app a class by in its own right?
( pardon me I am used to languages with constructors)

"Rob Windsor [MVP]" <ro************ *****@gmail.com > wrote in message
news:uR******** ******@TK2MSFTN GP09.phx.gbl...
As Armin suggested, you need to make Maim shared but if you do it in
place it will cause other problems. Add a Form_Load event handler to
SolverForm, copy all the code from Main to Form_Load and delete Main
then add this class:

Public Class AppStart
Public Shared Sub Main()
Application.Run (New SolverForm())
End Sub
End Class

Then, set the startup object to AppStart.Main

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/
"jg" <ju**@mail.pl s> wrote in message
news:uN******** ******@TK2MSFTN GP14.phx.gbl...
I setup a new windwos application project but I found out the sub main
was not called, I tried various form of Main (functions, subs) still no
luck. What did I miss?

Public Class SolverForm
Dim icnt_pieces = 0, iCurrent_Row = 0, iExpected_piece s = 16, i As
Integer
Dim ipb_piece() As PictureBox
Dim str_label() As String
Dim chr_Atrribute(i Expected_pieces )() As Char
Dim chr_AtrributeFl ip(iExpected_pi eces)() As Char
Dim b_used() As Boolean

Dim ipb_origin_loca tion As System.Drawing. Point
Dim ipb_origin_offs et As Integer = 106

Const CSTR_LABEL As String = "ABCDEFGHIJKLMN OPQRSTUVZ012345 6789"

Public Function Main(ByVal cmdArgs() As String) As Integer

MsgBox("MAIN - before new Game", MsgBoxStyle.Inf ormation, "@debug") '
never appear
NewGame()
ipb_piece(0) = PictureBox1
ipb_piece(1) = PictureBox2
ipb_piece(2) = PictureBox3
ipb_piece(3) = PictureBox4
.....
ipb_piece(15) = PictureBox16
MsgBox("MAIN - before calling rect", MsgBoxStyle.Inf ormation,
"@debug")
testRectangle()

End Function



Jan 4 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2248
by: F. GEIGER | last post by:
When I start a py2exe-ed application I get the error 'ascii' codec can't encode character u'\xe9' in position 10: ordinal not in range(128) This is how I run py2exe: setup.py py2exe -O1 --packages encodings This is how the .po-file looks like:
9
13462
by: Nadav | last post by:
Hi, I am tring to pass messages between threads, using the good old C++ I would call the GetMessage/PostThreadMessage APIs, Now, I am using C# and i can't find any equivalenty for these calls, any Idea how to communicate between threads and access the threads message queue will be appriciated... -- Nadav http://www.ddevel.com
19
2900
by: Charles Law | last post by:
Take a solution with a project hierarchy along the lines of an n-tier system, so that we have a data layer, business layer and presentation layer. The presentation layer is coupled to the business layer, and the business layer is coupled to the data layer. So far so good. Suppose the data layer raises an event, and it passes Me (the sender) as an object, and e (MyEventArgs, a descendent of EventArgs) to the layer above (the business...
1
1532
by: kmounkhaty | last post by:
Hi Guru, My profiler trace does not display SP:CACHEMISS event, even thought I drop store proc, clear both data cache and buffer cache but still does not work. Every thing works fine like: cachehit, cacheinsert,cacheremove,executecontexthit etc... Is there any special option that I need to turn it on?
98
4628
by: tjb | last post by:
I often see code like this: /// <summary> /// Removes a node. /// </summary> /// <param name="node">The node to remove.</param> public void RemoveNode(Node node) { <...> }
28
1729
by: Useful Info | last post by:
Like on 9/11, the Federal Government apparently WANTED people to die at the hands of Cho at VA Tech, because they told campus police not to pursue Cho after the double homicide occurred. Story via http://Muvy.org
8
12913
by: anukedari | last post by:
Hi, Could any boby please help to get the answers for the following questions: Is Apache always sends "X-Cache:MISS" header even when caching is off (disable)? or Can we say that cache settings are enable if it sends "X-Cache:MISS" header in the response? Your help would be appreciated.
21
35541
by: Ram Prasad | last post by:
I am trying to write a simple libspf2 plugin code for my postfix ( milter) I am getting this unhelpful error message when I try to compile gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c In file included from mfunc.c:1: mfunc.c:42: error: expected ')' before '*' token make: *** Error 1 my mfunc.c has on the line 42
0
1400
by: manikandan | last post by:
dont miss it just open dont miss it just open dont miss it just open #############################
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10228
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10006
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.