|
-
May 3rd, 2007, 04:55 AM
#1
Thread Starter
Just Married
[RESOLVED] [2.0] Need Help
Hii All
I need ur help in C#
I want to send variables value from one form to another.
In vb.Net we do this by take a module then declare a string like this
"Public user as string" now the string is accessible on whole application, but unfortunately in C#, we cannot do this in C#.
Plz, help me on this issue if u have the solution.
Thanks,
-
May 3rd, 2007, 07:29 PM
#2
Re: [2.0] Need Help
The C# equivalent of a VB.NET module is a static class. Note that the only difference is that you must qualify static class members with the class name, while module names can be omitted in VB.
Having said that, global variables should always be avoided unless they are truly needed. Using a module is not just a way of getting data from one form to another. If that's all you're using it for then you're misusing it. The way to pass data from one for to another is EXACTLY the same as the way to pass data from ANY object to another: set a property or pass a parameter to a method. You should ONLY use a module or static class if you truly need the member accessible throughout the entire project.
-
May 3rd, 2007, 11:52 PM
#3
Thread Starter
Just Married
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
|