473,789 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CheckS tate, 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 1960
Tony,

You launch form2 from form1 with something like this:

form2.ShowDialo g();

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.ShowDialo g() from form1, the ShowDialog() method
will return a DialogResult from form2, use the result like this:

if (form2.ShowDial og() == 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****@spamsuc ks.com> wrote in message
news:Ku******** *************@n ews.easynews.co m...
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.CheckS tate, 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****@spamsuc ks.com> wrote in message
news:Ku******** *************@n ews.easynews.co m...
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.CheckS tate, 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
1691
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 miles the person enters "myitem" is the row...there are seven rows where they can list expenses. "myvalue" * .375 = amount to be reimbursed All the rows are added and placed into the total.
10
2825
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 'f' with values '1' and '2' are used to distinguish calls from one form from those from the
2
2128
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 relative newcomer to Access and need to be methodical until it become more familiar. Thanks in advance for your help. I have a form with a subform that has a subform. form: frmEvents subform: sfrmTrialInfo (controlname = )
2
2416
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 web site to an ASP .NET Forms Authentication approach with SQL Server. I'm just getting comfortable with ASP .Net, but strong in Classic ASP.
8
1466
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 it doesn't work. I have been hacking away at it for a while to no avail. Can anyone spot the bug(s)? The RowSource property of Authors gets set to the following by this code, if that helps you help me:
11
1797
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 say i have Form1 and Form2. Each form is blank. ( no text boxes or anything ) Very Simple Example: ( i just need a start and then i can modify it and learn from it to do what i need to do )
6
2659
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. so far I have built a traditional app, switchboard, forms, etc. Part of this app is to automate the forms they previously prepared manually. After the app was built and works just fine, I find out there are several case managers using MS word...
1
1437
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
3311
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 the forms all at once, I'm opening them as needed. I have a main form with multiple records; and then I have a pop-up form that the user opens with button. The pop-up form contains one record relating to the current record in the main form (but...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9984
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.