Results 1 to 3 of 3

Thread: [RESOLVED] [2.0] Need Help

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Resolved [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,

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: [2.0] Need Help

    Thanks sir

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width