473,473 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DataBinding... (long)

public class Xxx
{
private string tableName = ""

public string TableName
{
get{return this.tableName;}
set
{
if(value != null)
{
this.tableName = value.Trim()
}
else
{
this.tableName = ""
}
}
}
}

Xxx xxx = new Xxx();

The scanario is:
I have a MdiContainer Form1 and I'm displaying MdiChilds in it.
On every child form I'm binding a TextBox Text property to a
property TableName of xxx passed to a child forms constructor
as an reference.

private Xxx xxx;

// Constructor
public FormChild(ref pXxx)
{
this.xxx = pXxx;
}

protected override OnLoad(...)
{
this.TaxtBox0.DataBindings.Add("Text",this.xxx,"Ta bleName");
}

Every time (beside the first time) the ChildForm is showing I have a probem
to move between its (ChildForm) controls after changing Text of TextBox0.
In other words if i change Text of my TextBox0 i have to click 2 or 3 times
on a save button (or any other control on the form) to get this button
clicked
or any control action perform.

Without DataBinding it works ok. It works ok also if Child form is not
called
from MdiParent as MdiChild but simply run as a modal form.

So what's wrong?

The code displaying ChildForm on MdiParentForm is:

ChildForm child = new ChildForm(ref xxx);
child.MdiParent = this.
this.contentPanel.Controls.Add(child)
child.Dock = DockStyle.Fill;
child.Show();

CleanupCode is:

child.Close();
child.Dispose();
child = null;

I think that DataBinding has some problem in general... Every time I use
it i'm geting some problems and instabilities. I saw in other programists
examles on gotdotnet and other that tey are not using DataBinding and
useng LoadData() and SaveData() methods to simply get and set propertys
of objects like:

LoadData()
{
this.TextBox0.text = this.xxx.TableName;
}

SaveData()
{
this.xxx.TableName = this.TextBox0.Text;
}

But I've got some controls in my propertys implementation and if value
is corrected I would like to user saw it before saving which scenario
above doesn't meet.
Nov 16 '05 #1
10 1479
One thing more...
If You replace my controls with
standard Windows Forms everything
works perfectly...
Nov 16 '05 #2
After a long fight I found a bug...

DCTextBox.Text property.Set

base.Text = value.Trim();

Trim causes the hangs. I don't know why
but without Trim() it works fine... :-)
Nov 16 '05 #3
Hi Jacek,

I have received your project, I will spend some time on it, I will reply to
you ASAP.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Nov 16 '05 #4
Hi Jacek,

Sorry for letting you wait for so long time.

After viewing your code, I found that the problem is just the String.Trim
method, just as you stated.

To workaround it, you may just do like this in "get" accessor:

get
{
string s=base.Text.Trim();
return s;
}

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #5
Hi Jacek,

Thanks very much for your feedback.

For your further issue, you may bring the child form to the front through
invoking:

Panel.SendToBack()

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #6
Hi Jacek,

Does my reply work for you? Do you still have any concern on this issue?

Please feel free to post. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #7
Jeffrey...

There is a MDIClient control in a Form1 of my example.
The problem is that MDIClient is independent to other
controls of the form. So Client forms are displayed in
MDIClient control but other controls (like tree view
and panel in my example are created in a form itself) So if
i would like to make my child form visible i have to
bring MDIClient to the front covering other form controls.
If i bring forms controls it covers MDIClient and my child
form ... madnaess!
There is no wey out because i can't add forms controls to
a MDIClient ...
Nov 16 '05 #8
Hi Jacek,

Thanks for your feedback.

I think we need not to send the Panel to back. I think you missed one code
statement in Child2 selection. If you add the fC2 in the child controls
collection of contentPanel, fC2 should appear. This works well:

case "Child2":
{
Child2 fC2 = new Child2();
fC2.MdiParent=this;
this.contentPanel.Controls.Add(fC2);

fC2.Show();

MessageBox.Show("Resume?");

break;
}

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #9
Yes ... it works ok but it's not perfect ...
I will'use it because I have no alternative...
Thank's Jeffrey :-)
Nov 16 '05 #10
Hi Jeffrey,

I am glad I can help you :-). You are welcome!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #11

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

Similar topics

0
by: Jacek Jurkowski | last post by:
public class Xxx { private string tableName = "" public string TableName { get{return this.tableName;} set { if(value != null)
0
by: Jacek Jurkowski | last post by:
public class Xxx { private string tableName = "" public string TableName { get{return this.tableName;} set { if(value != null)
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
1
by: thzero | last post by:
Is there any way to do this without using the ObjectDataSource? (Apologies for the long post) I have a simple data object: public class TestDO { public TestDO() {} public ID { get; set; }...
5
by: Peter M. | last post by:
I'm struggling with combobox databinding with something I consider a bug... I'm binding my combobox to an array of structs. The struct exposes two public properties, ID and Name, to be used as...
1
by: Johnny Jörgensen | last post by:
I've got a combobox where the SelectedValue property is bound to a class property by a code like this: MyComboBox.DataBindings.Add("SelectedValue", MyClass , "MyID"); My problem is that the...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
3
by: David Smith | last post by:
I have an app that shows the time it takes to execute a search, much like SQL Management Studio, but the app behaves as though the System.Windows.Forms.Timer gets blocked while binding the results to...
2
by: David C | last post by:
I have a drop down list control where I set AppendDataBound to true and added a list item of '<< add new>>' with a value of -1 to use for adding items to the list during data entry. When the user...
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,...
1
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.