DataBinding ... (long)

J

Jacek Jurkowski

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,"TableName");
}

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.
 
J

Jeffrey Tan[MSFT]

Hi Jacek,

I found that this post has been posted in this group. I have added a reply
to you in that post, please follow up me there, I will work with you.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DataBinding... (long) 10

Top