473,386 Members | 1,699 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,386 software developers and data experts.

Connect between two forms

Hi,

i've two forms i managed to connect with the two forms so if i press on the
first form on tools and then option the new form is rising, but the probelm
is, that i have on the new form a CheckBox that i can't see in the first form
why?

Thanks
Jun 11 '06 #1
4 9439
Hi Avi,
if you want to access the value in the checkbox on one form from another
form you will have to add an accessor on the form that returns the checkbox
value to allow you to get to the value i.e.

class FormWithCheckBox : Form
{
//assume this form has a checkbox called chkBxAccepted

public bool UserAccepted
{
get
{
return chkBxAccepted.Checked;
}
}
}
Then from the other form you can do:

class FormMain : Form
{
//called when user clicks on button
private void ClickHandler()
{
FormWithCheckBox f = new FormWithCheckBox();
f.ShowDialog() // or Show if non-modal

bool userAccepted = f.UserAccepted;

//do some stuff
}
}

Hope that helps
Mark Dawson
http://www.markdawson.org


"Avi G" wrote:
Hi,

i've two forms i managed to connect with the two forms so if i press on the
first form on tools and then option the new form is rising, but the probelm
is, that i have on the new form a CheckBox that i can't see in the first form
why?

Thanks

Jun 11 '06 #2
wow to hard for me, i'm real beginner, i'm working with VS 2005 isn't an easy
way to do it with VS 2005 or more simple code?

"Mark R. Dawson" wrote:
Hi Avi,
if you want to access the value in the checkbox on one form from another
form you will have to add an accessor on the form that returns the checkbox
value to allow you to get to the value i.e.

class FormWithCheckBox : Form
{
//assume this form has a checkbox called chkBxAccepted

public bool UserAccepted
{
get
{
return chkBxAccepted.Checked;
}
}
}
Then from the other form you can do:

class FormMain : Form
{
//called when user clicks on button
private void ClickHandler()
{
FormWithCheckBox f = new FormWithCheckBox();
f.ShowDialog() // or Show if non-modal

bool userAccepted = f.UserAccepted;

//do some stuff
}
}

Hope that helps
Mark Dawson
http://www.markdawson.org


"Avi G" wrote:
Hi,

i've two forms i managed to connect with the two forms so if i press on the
first form on tools and then option the new form is rising, but the probelm
is, that i have on the new form a CheckBox that i can't see in the first form
why?

Thanks

Jun 11 '06 #3
"Avi G" <Av**@discussions.microsoft.com> a écrit dans le message de news:
E0**********************************@microsoft.com...

| wow to hard for me, i'm real beginner, i'm working with VS 2005 isn't an
easy
| way to do it with VS 2005 or more simple code?

It really doesn't get much simpler than this, surrounding a private field
with a public property is standard practice. If you want to learn the right
way to do things rather than seek out kludges and poor coding, then there
are alternatives that will soon get you into more trouble than you can
handle :-)

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Jun 11 '06 #4
Hi Avi,
if the syntax is confusing to you, then you could replace the property
with a normal method, it really doesn't get any easier than calling a method
and it returning a value: i.e.

Instead of (obviosuly you can call this function whatever you want, I just
called it UserAccepted to indicate the checkbox was relating to the user
having to accept something on the form):
public bool UserAccepted
{
get
{
return chkBxAccepted.Checked;
}
}

can do:

public bool UserAccepted()
{
return this.chkBxUserAccepted.Checked;
}
Hope that is clearer.
Mark.
--
http://www.markdawson.org
"Avi G" wrote:
wow to hard for me, i'm real beginner, i'm working with VS 2005 isn't an easy
way to do it with VS 2005 or more simple code?

"Mark R. Dawson" wrote:
Hi Avi,
if you want to access the value in the checkbox on one form from another
form you will have to add an accessor on the form that returns the checkbox
value to allow you to get to the value i.e.

class FormWithCheckBox : Form
{
//assume this form has a checkbox called chkBxAccepted

public bool UserAccepted
{
get
{
return chkBxAccepted.Checked;
}
}
}
Then from the other form you can do:

class FormMain : Form
{
//called when user clicks on button
private void ClickHandler()
{
FormWithCheckBox f = new FormWithCheckBox();
f.ShowDialog() // or Show if non-modal

bool userAccepted = f.UserAccepted;

//do some stuff
}
}

Hope that helps
Mark Dawson
http://www.markdawson.org


"Avi G" wrote:
Hi,

i've two forms i managed to connect with the two forms so if i press on the
first form on tools and then option the new form is rising, but the probelm
is, that i have on the new form a CheckBox that i can't see in the first form
why?

Thanks

Jun 11 '06 #5

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

Similar topics

1
by: DAVID | last post by:
Hello, With regards to the Connect dialog on Oracle forms 6i via which we can connect to Oracle database, should we use the same functionality on forms run time again? I mean, I want to make a...
2
by: iwdu15 | last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i did a little fixing to the msdn version fo this, or 2) how to make a simple program that will connect and listen for...
0
by: Tim Zych | last post by:
I'm trying to connect to a SQL Server (Express) database with an Asp.Net solution that currently uses MS Access. I want to replace it with SQL Server. I got a rudimentary prototope to work in a...
2
by: Tim Zych | last post by:
I'm trying to connect to a SQL Server (Express) database with an Asp.Net solution that currently uses MS Access. I want to replace it with SQL Server. I got a rudimentary prototope to work in a...
6
by: Blast | last post by:
I was wondering if someone can tell me what Microsoft Technologies I need to employ for the given situation: As a small business, we keep all of our data currently in sql server and we only have...
0
by: qanita786 | last post by:
Hi, I also raise the question before that but no body reply me i am very disappointed from response my question is ? i want to connect forms 6i with microsoft sql server i create odbc connection...
0
by: moyoal | last post by:
Dear All, this is my first experience to connect forms and database using VPN from other location. we have client/server architectures, .FMX are available in 212.147.1.63 server. Database is...
0
by: moyoal | last post by:
Dear All, this is my first experience to connect forms and database using VPN / DSL from other location. we have client/server architectures, .FMX are available in 212.147.1.63 server. ...
9
by: kirk | last post by:
I have program.cs, my "main" form and then a "settings" form. My "main" form existed for awhile and I had constants, instantiations, properties, etc within it created. I went to create my...
0
by: =?Utf-8?B?dG9t?= | last post by:
Hi, I have a .net 2.0 windows client that connects to webservices. In most cases it works fine. However I have one client that gets 'Unable to connect to the remote server'. If on that client...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...

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.