Hi,
In VB Classic I used a sub main() in all my programs. How do I do that in
VB.net without setting the application type to Console application? Looks
like when I set it to console it disable some of the properites
First week of vb.net.... starting to really like it too.....
Brian 12 2697
Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project
properties and change the startup to your module.
Chris
That works, as long as I don't have "Enable application framework" check.
What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()?
Brian
"Chris" <no@spam.com> wrote in message
news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
"Brian Shafer" <bs********@community.nospam> wrote in
news:u9**************@TK2MSFTNGP15.phx.gbl: That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
Not much experience sub_Main-ing myself, but from what I've read:
System.Windows.Forms.Application.Run(formname) is the best method, though
formname.ShowDialog should also work.
The Confessor
Your form is just a class, you call it as you would any other class, by
making an instance of it in memory and then showing it.
"Brian Shafer" <bs********@community.nospam> wrote in message
news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
I do that and then it just shuts down... what is the proper syntax
"Scott M." <s-***@nospam.nospam> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Your form is just a class, you call it as you would any other class, by making an instance of it in memory and then showing it.
"Brian Shafer" <bs********@community.nospam> wrote in message news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
dim x as new YourFormClass
x.showdialog
"Brian Shafer" <bs********@community.nospam> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl... I do that and then it just shuts down... what is the proper syntax
"Scott M." <s-***@nospam.nospam> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Your form is just a class, you call it as you would any other class, by making an instance of it in memory and then showing it.
"Brian Shafer" <bs********@community.nospam> wrote in message news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: > Hi, > In VB Classic I used a sub main() in all my programs. How do I do > that in VB.net without setting the application type to Console > application? Looks like when I set it to console it disable some of > the properites > First week of vb.net.... starting to really like it too..... > Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
Hi,
In MyProject -> application tab click on the view application
events. Use the application startup event instead of sub main.
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs) Handles
Me.Startup
End Sub
End Class
Ken
----------------------
"Brian Shafer" <bs********@community.nospam> wrote in message
news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
Ken,
thanks for the tip.. I went to ms to find out more about this... and I
copied the following code.. but I get errors
Public Class StartupEventArgs
Inherits CancelEventArgs
Private Sub MyApplication_Startup( _
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs _
) Handles Me.Startup
For Each argument As String In My.Application.CommandLineArgs
If argument.ToLower = "/batch" Then
' Stop the start form from loading.
e.Cancel = True
End If
Next
If e.Cancel Then
' Call the main routine for windowless operation.
Dim c As New BatchApplication
c.Main()
End If
End Sub
Class BatchApplication
Sub Main()
' Insert code to run without a graphical user interface.
End Sub
End Class
the errors are
1. Type 'CancelEventArgs' is not defined.
2. Event 'Start' cannot be found.
???
any more help :)
Thanks
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi,
In MyProject -> application tab click on the view application events. Use the application startup event instead of sub main.
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs) Handles Me.Startup
End Sub End Class
Ken ---------------------- "Brian Shafer" <bs********@community.nospam> wrote in message news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: Hi, In VB Classic I used a sub main() in all my programs. How do I do that in VB.net without setting the application type to Console application? Looks like when I set it to console it disable some of the properites First week of vb.net.... starting to really like it too..... Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
I've run into problems with that before (in VB2003)... can't remember off
the top of my head what the problem was (some control or overlapping form
behaving funny or something).
I'd recommend using Application.Run(frm) instead. I think that's supposed to
be the "proper" way to do it.
--
-C. Moya www.cmoya.com
"Scott M." <s-***@nospam.nospam> wrote in message
news:OW**************@TK2MSFTNGP11.phx.gbl... dim x as new YourFormClass x.showdialog
"Brian Shafer" <bs********@community.nospam> wrote in message news:ed**************@TK2MSFTNGP09.phx.gbl...I do that and then it just shuts down... what is the proper syntax
"Scott M." <s-***@nospam.nospam> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Your form is just a class, you call it as you would any other class, by making an instance of it in memory and then showing it.
"Brian Shafer" <bs********@community.nospam> wrote in message news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework" check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... > Brian Shafer wrote: >> Hi, >> In VB Classic I used a sub main() in all my programs. How do I do >> that in VB.net without setting the application type to Console >> application? Looks like when I set it to console it disable some of >> the properites >> First week of vb.net.... starting to really like it too..... >> Brian > > Make a module. Put a sub main in there. Then go to the project > properties and change the startup to your module. > > Chris
Carlos I'd recommend using Application.Run(frm) instead. I think that's supposed to be the "proper" way to do it.
Jay Harlow has once made a message where he has showed 8 proper ways to go
in VBNet using a form.
It is just a matter of preference. And sometimes a matter of how to do,
without a form or page it is hard to use the inbuild methods from that.
Cor
Cor,
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb: I'd recommend using Application.Run(frm) instead. I think that's supposed to be the "proper" way to do it.
Jay Harlow has once made a message where he has showed 8 proper ways to go in VBNet using a form.
It is just a matter of preference. And sometimes a matter of how to do, without a form or page it is hard to use the inbuild methods from that.
If the application needs a message pump, then I recommend to use
'Application.Run' instead of showing a form as a modal dialog, which is
semantically incorrect. Sure, there are different ways of showing forms...
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Hi Brian, the errors are 1. Type 'CancelEventArgs' is not defined. 2. Event 'Start' cannot be found.
Based on MSDN documentation, class CancelEventArgs is declared in the
Namespace: System.ComponentModel. So please check whether you have used
this correct namespace in your project.
I hope the above information is helpful for you. Thanks and have a nice day!
Best Regards,
Terry Fei [MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
--------------------From: "Brian Shafer" <bs********@community.nospam> References: <eB**************@TK2MSFTNGP15.phx.gbl>
<ON**************@TK2MSFTNGP12.phx.gbl>
<u9**************@TK2MSFTNGP15.phx.gbl>
<#L**************@tk2msftngp13.phx.gbl>Subject: Re: sub Main Date: Mon, 20 Feb 2006 02:33:06 -0500 Lines: 110 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response Message-ID: <eg**************@TK2MSFTNGP09.phx.gbl> Newsgroups: microsoft.public.dotnet.languages.vb NNTP-Posting-Host: 12-208-237-55.client.insightbb.com 12.208.237.55 Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP09.phx.gbl Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.languages.vb:318449 X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Ken, thanks for the tip.. I went to ms to find out more about this... and I copied the following code.. but I get errors Public Class StartupEventArgs
Inherits CancelEventArgs
Private Sub MyApplication_Startup( _
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs _
) Handles Me.Startup
For Each argument As String In My.Application.CommandLineArgs
If argument.ToLower = "/batch" Then
' Stop the start form from loading.
e.Cancel = True
End If
Next
If e.Cancel Then
' Call the main routine for windowless operation.
Dim c As New BatchApplication
c.Main()
End If
End Sub
Class BatchApplication
Sub Main()
' Insert code to run without a graphical user interface.
End Sub
End Class the errors are
1. Type 'CancelEventArgs' is not defined.
2. Event 'Start' cannot be found.
???
any more help :)
Thanks
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hi,
In MyProject -> application tab click on the view application events. Use the application startup event instead of sub main.
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupE ventArgs) Handles Me.Startup
End Sub End Class
Ken ---------------------- "Brian Shafer" <bs********@community.nospam> wrote in message news:u9**************@TK2MSFTNGP15.phx.gbl... That works, as long as I don't have "Enable application framework"
check. What is the main purpose of "Enable application framework"
Also, what is the proper way of opening a form from the sub Main()? Brian
"Chris" <no@spam.com> wrote in message news:ON**************@TK2MSFTNGP12.phx.gbl... Brian Shafer wrote: > Hi, > In VB Classic I used a sub main() in all my programs. How do I do > that in VB.net without setting the application type to Console > application? Looks like when I set it to console it disable some of
the> properites > First week of vb.net.... starting to really like it too..... > Brian
Make a module. Put a sub main in there. Then go to the project properties and change the startup to your module.
Chris
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kwan Ting |
last post by:
The_Sage, I see you've gotten yourself a twin asking for program in
comp.lang.c++ .
http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=45cd1b289c71c33c&rnum=1
If you the oh so mighty...
|
by: Steven T. Hatton |
last post by:
This is a purely *hypothetical* question. That means, it's /pretend/,
CP. ;-)
If you were forced at gunpoint to put all your code in classes, rather than
in namespace scope (obviously classes...
|
by: Fred Zwarts |
last post by:
In C++ execution of a program starts already before execution of main().
The initialization of static variables defined outside the scope of main
is performed first. I could imagine a program where...
|
by: Beni |
last post by:
I have been programming in C for about a year now. It sounds silly,
but I never took the time to question why a C(or C++ or Java) program
execution begins only at the main(). Is it a convention or...
|
by: Seong-Kook Shin |
last post by:
Hi, I'm reading Steve's "C Programming FAQs" in book version,
and have two question regarding to Q11.16
... Also, a `return' from `main' cannot be expected to work if
data local to main might be...
|
by: Sokar |
last post by:
I have my main function set up as
int main(int argv, char *argv)
so taht i can read in a variable which is passed to the program on the
command line. The problem is that main calls other...
|
by: Geoff Jones |
last post by:
Hi
What is the closest equivalent to Main in a VB.Net form?
Geoff
|
by: psuaudi |
last post by:
I have a main query that I would like to call two different subqueries.
In MS Access, I usually just save the two subqueries as separate queries which are then called by a third separate and main...
|
by: ravi |
last post by:
Hello everybody,
I am writing a small application which does some work before the user
main function starts execution.
I am trying to #define the main function.
But the problem is that,
|
by: aarklon |
last post by:
Hi all,
I have heard many discussions among my colleagues that main is a user
defined function or not.
arguments in favour:-
1) if it is built in function it must be defined in some header...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |