CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Modules in C#

  1. #1
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Question Modules in C#

    Good Afternoon All

    In VB.NET i used to have a Module. I need to Call the Main Form when the login is successfully. So this is what i deed in C# so Far in a Class, Can someone Help me on this in C#. Becaues C# does not have Modules.

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace SystemAdmin
    {
    
        class Startup
        {
            public void Main()
            {
    
                bool loggedIn;
    
                frmLogin frmlogin = new frmLogin();
    
                loggedIn = (frmlogin.ShowDialog() == DialogResult.OK);
    
                if (loggedIn)
                {
    
                    Application.Run(new frmmain());
    
                }
            }
        }
    }

    And my Login Screen Login button is like this

    Code:
    String strusername = txtusername.Text; 
    
                String Password = txtpassword.Text;
            
                int bl ;
    
                bl = obj.Check_Login(strusername, strPassword);
    
                if (bl == 1)
                {
                    Me.DialogResult = Windows.Forms.DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Invalid Login");
                }
    Thanks
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Modules in C#

    Well Modules in VB have their downsides...
    People prefer declaring all their public variables inside a module, but that doesn't make your program 100% object oriented - I guess it's just my opinion...

    One option may be to make sealed classes with private constructors ( where all the members are static )

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Modules in C#

    Your post looks like reasonable C#....

    What is the PROBLEM?????
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  4. #4
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Re: Modules in C#

    OK

    My Problem is shown on ScreenShot
    Attached Files Attached Files
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

  5. #5
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Modules in C#

    1) you do not have a class named "frmLogin" in the current namespace, nor do you have a "using" statement to import the namespace.

    2) You do not have the proper namespace for Dialog Result.


    A simple "right-click" and "Resolve..." will address the issues, if the proper assemblies are referenced in your project.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  6. #6
    Join Date
    Dec 2007
    Location
    South Africa
    Posts
    263

    Resolved Re: Modules in C#

    Thank you Very much, its Resolved
    Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

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

Featured