473,320 Members | 2,162 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,320 software developers and data experts.

User Control has no impact on parent control carrencyManager

My question concerns C# Windows Forms user controls.
I have created navigation user control. It gets the consumer
application parent control's (a Form) CurrencyManager to its bindable
property. In the user control, any change in the CurrencyManager
position is displayed OK.
The problem is that the position of the parent CurrencyManager stays
intact (doesn't change at all).
Here is the code of the consumer application:

private void Form1_Load(object sender, System.EventArgs e)
{
dataGrid1.DataSource = ds.Customers;

// Set the UserContol's properties
this.userControl11.ParentControl = this;
this.userControl11.ControlCurrencyManager = (CurrencyManager)
this.BindingContext[ds,"Customers"];
}

In methods, a reference parameter solves such problem, but I don't know
how to implement it with a user control.
Any help will be very much appreciated.
Thanks,
David

Nov 17 '05 #1
3 1431
Hi,

Sorry to ask but if you want the parent to have the currencyManager as well
where are you calling it on your function? I can't see it.

Anything assigned to your usercontrol will remain within that boundary, in
your example you are assigning the currencymanager to your user control and
not to the parent at all.

Maybe I didn't understand what you mean...

Regards
Salva

"David K." wrote:
My question concerns C# Windows Forms user controls.
I have created navigation user control. It gets the consumer
application parent control's (a Form) CurrencyManager to its bindable
property. In the user control, any change in the CurrencyManager
position is displayed OK.
The problem is that the position of the parent CurrencyManager stays
intact (doesn't change at all).
Here is the code of the consumer application:

private void Form1_Load(object sender, System.EventArgs e)
{
dataGrid1.DataSource = ds.Customers;

// Set the UserContol's properties
this.userControl11.ParentControl = this;
this.userControl11.ControlCurrencyManager = (CurrencyManager)
this.BindingContext[ds,"Customers"];
}

In methods, a reference parameter solves such problem, but I don't know
how to implement it with a user control.
Any help will be very much appreciated.
Thanks,
David

Nov 17 '05 #2
Hi Salva,
The Form1_Load function is in the cunsumer application Windows Form. I
assign The Form's CurrencyManager to the the CurrencyManager property
of the user control.
I expect that any change that is made in the Position property of the
CurrencyManager in the user control, will be made in the
CurrencyManager.Position of the Form in the cunsumer application, as
well. Unfortunately, it stays intact.
If it is impossible, maybe there is a way for the user control to
return an object.

David

Nov 17 '05 #3
Hi,

The usercontrol is able to return whatever you want, if you want to retrieve
an object just use:

public class YourUserControl
{
private object WhateverObject;

public object GetObject
{
get { return WhateverObject;}
}
}

You can apply this to any object, including your currencymanager. Also you
can return it on a function, or by ref/out in a parameter.

Cheers
Salva
}

"David K." wrote:
Hi Salva,
The Form1_Load function is in the cunsumer application Windows Form. I
assign The Form's CurrencyManager to the the CurrencyManager property
of the user control.
I expect that any change that is made in the Position property of the
CurrencyManager in the user control, will be made in the
CurrencyManager.Position of the Form in the cunsumer application, as
well. Unfortunately, it stays intact.
If it is impossible, maybe there is a way for the user control to
return an object.

David

Nov 17 '05 #4

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

Similar topics

0
by: Jack | last post by:
Hello everyone, I have an event the kicks off from way down inside a user control. It is 4-5 levels deep, i.e. me.parent.parent.parent.parent.parent is the main form. The event needs to be able...
1
by: Ian | last post by:
I have a parent MDI with a menu that calls all the children forms and that works fine. My issue is I created a user control that looks like a toolbar and it has various windows controls on it and...
2
by: David K. | last post by:
My question concerns C# Windows Forms user controls. I have created navigation user control. It gets the parent control's CurrencyManager to its bindable property. In the control, any change in...
1
by: moondaddy | last post by:
I need to replace a user control on a page with a different user control. The challenge I'm faced with is that this call is being made from the user control being replaced. Normally I replace...
5
by: George Durzi | last post by:
I have a simple user control with a text box and a submit button. When the user enters some text into the textbox and clicks the submit button, a record is created in the database. I'm using...
5
by: Steve Richter | last post by:
In my user control I want to read the ViewState dictionary of the Parent control. But this sensible idea is not permitted by the compiler: Compiler Error Message: CS1540: Cannot access...
10
by: sqlboy2000 | last post by:
Hello all, I have something very simple going on here and I'm scratching my head as to what the problem is. There are 4 items in my project, 2 webforms, a user control, and a module: ...
6
by: Art | last post by:
Hi I'm new at this and need some help. I have a "solution" with 2 projects - the main project and a library. The library is simple, it contains a text box that will appear many times in the form...
6
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.