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

How to transfer a variable from a Form to an other ?

Hi everyone,
I'm working on a project that uses 2 forms : one to select an object
and one other to display its attributes.
I mean that in the first one I select an object (from a ComboBox),
then I open a new form where I could see all the properties of that
object.

The problem is that I can't find a way to "transfer" my SelectedItem
from my selection Form to the other Form.

I tried to declare a private attribute with some accessors like that:
================================================== ===
public partial class TheForm : Form
{
private MyObject _theObject;
public MyObject theObject
{
get
{
return this._theObject;
}
set
{
this._theObject = value;
}
}
private void TheForm_Load(object sender, EventArgs e)
{
============================================
But that generate accessibility errors on compilation.
Does anyone can help me Please ?

Regards

Romain KEIRSEBILCK

Aug 30 '07 #1
3 1792
On Aug 30, 1:10 pm, rom15b...@gmail.com wrote:
Hi everyone,
I'm working on a project that uses 2 forms : one to select an object
and one other to display its attributes.
I mean that in the first one I select an object (from a ComboBox),
then I open a new form where I could see all the properties of that
object.

The problem is that I can't find a way to "transfer" my SelectedItem
from my selection Form to the other Form.

I tried to declare a private attribute with some accessors like that:
<snip>
But that generate accessibility errors on compilation.
Does anyone can help me Please ?
The accessibility error would probably be due to MyObject being
declared as an internal class. Either make it public, or make the
property internal too.

Jon

Aug 30 '07 #2
On Aug 30, 8:10 am, rom15b...@gmail.com wrote:
Hi everyone,
I'm working on a project that uses 2 forms : one to select an object
and one other to display its attributes.
I mean that in the first one I select an object (from a ComboBox),
then I open a new form where I could see all the properties of that
object.

The problem is that I can't find a way to "transfer" my SelectedItem
from my selection Form to the other Form.

I tried to declare a private attribute with some accessors like that:
================================================== ===
public partial class TheForm : Form
{
private MyObject _theObject;
public MyObject theObject
{
get
{
return this._theObject;
}
set
{
this._theObject = value;
}
}
private void TheForm_Load(object sender, EventArgs e)
{
============================================
But that generate accessibility errors on compilation.
Does anyone can help me Please ?

Regards

Romain KEIRSEBILCK
Define a property in the form TheForm. Before closing the form, set
the property's value to the control in question. When the form closes,
the property will be available to the form that opened TheForm.

Aug 30 '07 #3
Waaaaa... Guess what its finally working !!
Thanks a lot
I didn't know the internal stuff, I learned something today..

See you
Best Regards

Aug 30 '07 #4

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

Similar topics

2
by: Jeremy | last post by:
I'm having some problems with using Server.Transfer and I am hoping somebody can help me. Page 1 has a datagrid, Page 2 has a form. If a user goes to page 1 and selects something out of the...
5
by: Julien C. | last post by:
Hi all, I have an "EditeItem.aspx" page which lets me edit properties of an "Item". In the OnClick() event of my Save button, I do save Item changes to the database and then I redirect the user...
4
by: Bob H | last post by:
Hi, I'm aware of the different ways to pass variables between ASP.Net pages. For pages that need to pass a variable, we're using the server.transfer method. For others, we're using...
11
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it...
2
by: P K | last post by:
I am using server.transfer for a website being developed in vs.net 2005 And I need to get the posted values after server.transfer. For this I set the second parameter "true" in the transfer...
2
by: Alex | last post by:
Hello, Quick question and I would really appreciate if anybody could helps me. Here are the steps to reproduce the problem. Create simple ASP.Net application. In code behind added protected...
23
by: barryfz | last post by:
I need to be able to move from one web app on my server to another on the same server and preserve the session state. I have played with server.transfer but I get an error saying I can't do this....
3
by: plennin | last post by:
Can anyone help me please!! I need to transfer the value of a variable from a web page to a hidden field in a web form which can then be sent via email. I have several web pages that link to a...
2
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi, I'm using Threads, and when I try to do Server.Transfer, I recieved an error. (child object does not exist...) My Code: Dim t As New Thread(AddressOf Hilo) Private Sub Hilo()...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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...

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.