CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2010
    Posts
    3

    A poor lost newbie

    I'm trying to write a fully functional program for my class. Its a make up for a missed midterm. Its a simple database program. I want it to start by asking for a user name and password then once that is compared to whats in the database. If found it closes the login window and shows the main menu were you can add stuff to the database remove stuff from it (ex. find a class and sign up for it, remove yourself from a class, etc...). BUT I'm having so many problems with it. I have everything technically working, I have classes that connect to the database I can add, remove, modify, and what not. I'm having problems implementing it all how do I have just the login form appear and then disappear when someone logs in. Then show a main form, where most of this stuff happens. Maybe another form to do something else. I've tinkered with static variables in a class (so there like global variables), but I've found out that's not a good way to program.

    what my question boils down to is, I can't find any examples of how to properly program a program. So I just lost on how to do this the correct way.

    I can't find any examples of what I should do. Any help would be appreciated

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: A poor lost newbie

    See the link in my signature, and find the correct version. Working Samples
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    May 2007
    Location
    Denmark
    Posts
    623

    Re: A poor lost newbie

    In Program.cs, you should be doing something like this:

    Code:
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //LoginForm is your login form.
            //It should set its DialogResult property when closing to
            //indicate whether or not the login was successful.
            using (LoginForm form = new LoginForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                    Application.Run(new Main());
            }
        }
    }
    It's not a bug, it's a feature!

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