How to declare global Variables in VB.NET and C#?
VB.NET
In VB.NET we have module to declare global variable, which can be accessed across all the forms
Module Module1
Public moduleinteger As Integer
End Module
C#
In C#.NET we don't have any Module to declare global variables, so in C# we can declare a public class with public static variable which can be across all the forms
namespace Module{
public class Module1
{
public static int moduleinteger;
}
}
access like Module1.moduleinteger
6 Comments:
This comment has been removed by the author.
gr8 help
thanks
finally know how to use global variable :P thank you
Thanks a lot for this.
I do have one question though - what is the difference between 'const' and 'static'
Thanks in advance.
Thanks a lot...for ur valuable code...keep going on...
thx you!
Post a Comment
<< Home