|
-
Dec 28th, 2002, 02:15 AM
#1
Thread Starter
Frenzied Member
For those like me who didn't know this before ;)
If you start your program with sub main (main not Main) then you will face strange behaviour. It's a known bug!
-
Dec 28th, 2002, 06:05 AM
#2
Sleep mode
I tried both ways without any bugs!!
VB became easier because its complier doesn't differentiate Case-state of code.No matter it's Lower or Upper Cases but C++ does.
VB Code:
Sub Main()
MsgBox("From Main Sub")
End Sub
'Sub main()
'MsgBox("from main sub")
'End Sub
Dunno if you are doing something else!!!
-
Dec 28th, 2002, 06:31 AM
#3
What kind of strange behavior are we talking about?
-
Dec 28th, 2002, 07:30 AM
#4
Thread Starter
Frenzied Member
Try the following and see the result:
VB Code:
Sub main()
Msgbox(Application.ProductName)
End sub
and then try with Sub Main().
-
Dec 29th, 2002, 04:37 AM
#5
Sleep mode
I've even tried MAIN , absolutely gives no difference.
?
-
Dec 29th, 2002, 06:25 AM
#6
Thread Starter
Frenzied Member
Well I dont know what you tried, but as far as i searched this is a known bug and happens in some methods and properties of System.Windows.Forms.Application class, and running before mentioned code with sub main not Main will resulat in the error:
object refrecnce not set to an instance ....
-
Dec 29th, 2002, 07:39 AM
#7
Sleep mode
VB Code:
'I created a class (love classes) and pasted
'your code as follow :
Sub Main()
MsgBox(Application.ProductName)
End Sub
'and
'Sub main()
' MsgBox(Application.ProductName)
'End Sub
' in a form I did this :
'Dim mymain As New Class1()
'mymain.main()
'both gave the same results .
' but if I did this:
' Dim mymain As Class1
' mymain.main()
'I get that stupid error so .
'the error explain itself .i.e you are trying to use the
'base class itself rather than dimming an object that holds
'its instance.
'I did all this , just to assure myself ,there is no such error.
-
Dec 29th, 2002, 09:07 AM
#8
Thread Starter
Frenzied Member
Come on man!
I said if you start your program with a Sub main in a module not calling that from a form when it is inside a class.
-
Dec 29th, 2002, 09:13 AM
#9
Sleep mode
that error happen when while instantiating subs or func. so I tried that.
-
Dec 29th, 2002, 09:24 AM
#10
Sleep mode
oh YOU ARE RIGHT. when I set the app startup from module and run the app , it fires the error.
sorry for that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|