Click here to Skip to main content
15,920,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone

I am developing a Time Tracking system where i have a clock in and clock out buttons, a person clocks in and exit the application, when they come back to open the application again, the clock in button must be disabled and the clock out button enabled.

Thank you in advance.
Posted
Updated 26-Mar-15 22:40pm
v2
Comments
OriginalGriff 27-Mar-15 4:50am    
And?
What have you tried?
Where are you stuck?
What help do you need?
BillWoodruff 27-Mar-15 11:48am    
Either your application must stay running all the time and keep track of log-ins and log-outs, or you must save the state of the currently logged in users when you exit the application, and restore it when you open the application. There's no other way.
Nhle 30-Mar-15 2:11am    
Thank you Guys, I appreciate your help.

You must save the last state of your application when it is about to shut down
and read it on startup.

This article explains how to persist user settings:
Windows Forms User Settings in C#[^]
 
Share this answer
 
Comments
BillWoodruff 27-Mar-15 13:27pm    
+5 Good answer.
TheRealSteveJudge 29-Mar-15 14:02pm    
Thank you!
Thank you so much for your responses...

But i do not use login on my application. on page load I have a list box that has names and two (Clockin and Clockout) disabled buttons, if a person select their name that is when the buttons get enabled.

When the name is selected from the list box, the clock in button gets enabled; when a person clicks on that button they are able to clock in on the system and the button clock out gets enabled, then they are able to clock out of the system as well.

The only problem is when a person clocks in on the system and then decide to close the application, next time they open the application, select their name from the list box the clock out button must be enabled for them to clock out. The system must not allow them to clock in two times.
 
Share this answer
 
Comments
BillWoodruff 27-Mar-15 11:46am    
Please post responses to solutions by using the "Have a Comment or Suggestion" button underneath the solution ... not ... as you are doing here ... by posting as a solution.
There is no concept of Session variables in windows forms.

Create a Static class that holds the User name and password and any other variables needed across the application .

In your case it would be something like:

C#
public static class LoginInfo
{
    public static string UserID;
}
Now you can access the UserID simply from anywhere in your code:

MessageBox.Show(LogInfo.UserID);
Or set the values after login like

LogInfo.UserID=TextBox1.Text;







use just this type of concept.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900