Click here to Skip to main content
15,922,155 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: how do I Convert Filetime to datetim Pin
Dave Kreskowiak13-Apr-06 13:42
mveDave Kreskowiak13-Apr-06 13:42 
GeneralRe: how do I Convert Filetime to datetim Pin
David M J14-Apr-06 6:22
David M J14-Apr-06 6:22 
Questionreading msg file Pin
pnpfriend13-Apr-06 5:41
pnpfriend13-Apr-06 5:41 
AnswerRe: reading msg file Pin
Dave Kreskowiak13-Apr-06 7:12
mveDave Kreskowiak13-Apr-06 7:12 
GeneralRe: reading msg file Pin
pnpfriend14-Apr-06 8:02
pnpfriend14-Apr-06 8:02 
GeneralRe: reading msg file Pin
Dave Kreskowiak14-Apr-06 9:05
mveDave Kreskowiak14-Apr-06 9:05 
QuestionGlobal variable and Sub Main() Pin
percyvimal13-Apr-06 4:25
percyvimal13-Apr-06 4:25 
AnswerRe: Global variable and Sub Main() Pin
Dave Kreskowiak13-Apr-06 7:06
mveDave Kreskowiak13-Apr-06 7:06 
percyvimal wrote:
1.How to declare global variables.


Global variables don't exist in the .NET Framework. They're also bad practice. You can simulate something close by declaring your variables as Shared in another class:
Public Class HelpersLibrary
    Public Shared myGlobalVariable As Integer
End Class



percyvimal wrote:
2.where to declare ( in VB6 used to declare those in Modules what about 2005?)


Modules are an outdated concept. They're only there for backwards compatibility with VB6.


percyvimal wrote:
3.How to make the application Run the Sub Main() function


You actually have to turn off the "Enable Application Framework" option in My Project before Sub Main will show up in the list. After that, all you have to do is supply a Sub Main in either a Module or a Class. For a Module, add a new one to your project, then put something like the following code in it:
Module MainStartupCode
    Public Sub Main()
        ' Your startup code begins here
        ' To launch a form and start your Windows GUI:
        Application.Run(New mainForm)
    End Sub
End Module

Or, to support command line arguments:
Module MainStartupCode
    Public Sub Main(ByVal cmdArgs() As String)
        ' Your startup code begins here
        ' To launch a form and start your Windows GUI:
        Application.Run(New mainForm)
    End Sub
End Module


Now, you don't have to have a Module to supply a Sub Main. You can do it with a Shared member Sub of a class:
Public Class Form1
    <STAThread()> _
    Public Shared Sub Main()
        ' Same as above examples...
    End Sub
 
    ' the rest of your form code goes here...
End Class

Don't forget to go back into MyProject and select Sub Main< from the Startup object dropdown.


percyvimal wrote:


What happened to 4?


percyvimal wrote:
5.How to end the application Frmmdiform.END


Me.Close()



Dave Kreskowiak
Microsoft MVP - Visual Basic

GeneralRe: Global variable and Sub Main() Pin
percyvimal13-Apr-06 11:25
percyvimal13-Apr-06 11:25 
GeneralRe: Global variable and Sub Main() Pin
Dave Kreskowiak13-Apr-06 12:14
mveDave Kreskowiak13-Apr-06 12:14 
AnswerRe: Global variable and Sub Main() Pin
cosma21715-Apr-06 6:05
cosma21715-Apr-06 6:05 
GeneralRe: Global variable and Sub Main() Pin
percyvimal15-Apr-06 23:11
percyvimal15-Apr-06 23:11 
QuestionDamage variable Pin
Mr kilany13-Apr-06 3:27
Mr kilany13-Apr-06 3:27 
AnswerRe: Damage variable Pin
Dave Kreskowiak13-Apr-06 7:07
mveDave Kreskowiak13-Apr-06 7:07 
GeneralRe: Damage variable Pin
Mr kilany15-Apr-06 3:16
Mr kilany15-Apr-06 3:16 
GeneralRe: Damage variable Pin
Dave Kreskowiak15-Apr-06 4:43
mveDave Kreskowiak15-Apr-06 4:43 
GeneralRe: Damage variable Pin
Mr kilany17-Apr-06 3:17
Mr kilany17-Apr-06 3:17 
GeneralRe: Damage variable Pin
Dave Kreskowiak17-Apr-06 12:11
mveDave Kreskowiak17-Apr-06 12:11 
GeneralRe: Damage variable Pin
Mr kilany18-Apr-06 3:26
Mr kilany18-Apr-06 3:26 
GeneralRe: Damage variable Pin
Dave Kreskowiak18-Apr-06 12:16
mveDave Kreskowiak18-Apr-06 12:16 
GeneralRe: Damage variable Pin
Mr kilany19-Apr-06 7:56
Mr kilany19-Apr-06 7:56 
GeneralRe: Damage variable Pin
Dave Kreskowiak19-Apr-06 11:41
mveDave Kreskowiak19-Apr-06 11:41 
Questionvery simple question but no answer Pin
Amit Agarrwal13-Apr-06 3:15
Amit Agarrwal13-Apr-06 3:15 
AnswerRe: very simple question but no answer Pin
Dave Kreskowiak13-Apr-06 7:33
mveDave Kreskowiak13-Apr-06 7:33 
Questionhandling application instances Pin
crosshair13-Apr-06 2:05
crosshair13-Apr-06 2:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.