-
April 7th, 2010, 11:51 PM
#1
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
-
April 8th, 2010, 01:37 AM
#2
Re: A poor lost newbie
See the link in my signature, and find the correct version. Working Samples
-
April 8th, 2010, 01:51 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|