473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

New guy needs some help with multiple forms..

Hi Guys,

I just need a push in the right direction here, I'm kinda stuck.

I have a project with multiple Windows Forms launching from the main form by
use of checkboxes. very easy, got that handled.

The problem I have is this: If the "cancel" button is pressed on one of the
spawned forms I can close that form, but I need to uncheck the checkbox on
that was originally checked.

I saw checkBox.CheckState, but since I am operating in another class (say
Form2.cs), how could I manipulate the checkbox that is in Form1.cs and
change the state to unchecked?

I'm sure this is something simple and I'm just suffering from newbie-itis...
but if you have a minute to help I would be most appreciative.

Thanks,

-Tony
Nov 15 '05 #1
2 1947
Tony,

You launch form2 from form1 with something like this:

form2.ShowDialog();

What you need to do is add some more code and check for OK or Cancel in the
dialog result. So, make sure your Dialog Result for the Cancel button on
form2 is set Cancel, and the Dialog Result for the OK button is set to OK
(look in the properties under behavior for each button).

Now, when you call form2.ShowDialog() from form1, the ShowDialog() method
will return a DialogResult from form2, use the result like this:

if (form2.ShowDialog() == OK)
{
//DO SOMETHING THAT IS OK TO DO

}
else
{
//CANCEL WAS HIT - or check for explicit values if needed

//set your checkbox to unchecked
this.myCheckBox.Checked = false;

}

Matt

"TonyM" <Bi****@spamsucks.com> wrote in message
news:Ku*********************@news.easynews.com...
Hi Guys,

I just need a push in the right direction here, I'm kinda stuck.

I have a project with multiple Windows Forms launching from the main form by use of checkboxes. very easy, got that handled.

The problem I have is this: If the "cancel" button is pressed on one of the spawned forms I can close that form, but I need to uncheck the checkbox on
that was originally checked.

I saw checkBox.CheckState, but since I am operating in another class (say
Form2.cs), how could I manipulate the checkbox that is in Form1.cs and
change the state to unchecked?

I'm sure this is something simple and I'm just suffering from newbie-itis... but if you have a minute to help I would be most appreciative.

Thanks,

-Tony

Nov 15 '05 #2
Oh yeah - if I forgot anything it's because I've got the cold of my life and
the NyQuil is kicking in :)
"TonyM" <Bi****@spamsucks.com> wrote in message
news:Ku*********************@news.easynews.com...
Hi Guys,

I just need a push in the right direction here, I'm kinda stuck.

I have a project with multiple Windows Forms launching from the main form by use of checkboxes. very easy, got that handled.

The problem I have is this: If the "cancel" button is pressed on one of the spawned forms I can close that form, but I need to uncheck the checkbox on
that was originally checked.

I saw checkBox.CheckState, but since I am operating in another class (say
Form2.cs), how could I manipulate the checkbox that is in Form1.cs and
change the state to unchecked?

I'm sure this is something simple and I'm just suffering from newbie-itis... but if you have a minute to help I would be most appreciative.

Thanks,

-Tony

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Abby Lee | last post by:
My function works but there has got to be a way to make a for loop to handle this...but I can't get a for loop to work. You can tell, I'm not very good at this...help. "myvalue" is the number of...
10
by: Joseph S. | last post by:
Hi, How do I pass a string from one call to a php block to another call in the same page but from another form? Here's my full php code: I'm using two forms in the same page. A hidden field...
2
by: Susan Bricker | last post by:
Greetings. Before I begin, I have been stuck on this problem for about a 5 days, now. I have tried and just seem to be not getting anywhere. I know that the explanation is lengthy, but I am a...
2
by: Joe Rigley | last post by:
Help Please! I've been tasked with converting a portion of the corporate web site that currently utilizes local user accounts and NTFS via Basic Authentication to access certain files on the...
8
by: darnnews | last post by:
I have a form. When a person selects a publication from a listbox, this snippet of code is supposed to look up authors that correspond to that publication and populate the Author List Box, but...
11
by: Miro | last post by:
I am banging my head around something that I think I just dont understand what I am reading in the helps. Its gotta be so simple but I just cant figure out what im reading. ( vb 2003 ) Lets...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
1
by: colleen1980 | last post by:
Hi: I am trying to pull all the values from the listbox. But the ASP code shows only the last record. Needs help HTML <html> <head>
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.