TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kim Larsen
NA
3
0
Open/Close form on same button
Aug 13 2009 5:11 AM
Hey all! I have a problem, which consist of a button that is supposed to open a form, and if i click that button again, the Form should close, and only 1 of this form should be able to run at the time. Problem is that it keeps opening more forms as i click my button. [code] private void button1_Click(object sender, EventArgs e) { int on = 1; int off = 0; StartMenu StartMenu = new StartMenu(); if (on < off) { StartMenu.Dispose(); on = 1; off = 0; } else if(on > off) { StartMenu.Show(); off = 1; on = 0; } } [\code] This is the code that i attempted to make for the button to register whether the button is active or inactive, and choose if the Form should open or close. :) Hope you can help!! Looking into it my code was not readable, i'll try to organize it. :)
Reply
Answers (
3
)
Select a record at a particular date from Access database using C#.net Code
Enter Key in DataGrid