Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > How do I catch row (position change) in detailview of windows form?
 

How do I catch row (position change) in detailview of windows form?

what I could like to do is whenever the single record detailview is moved to a different record corresponding to the datasource,set a few unbound checkboxes using values from a couple of disabled and bound texbox control

I was looking at using bindingmanager but I lack the required understanding and could not get hold the ofbinding manager

I can catch the state change on the checkboxes easily to update teh boudn textboes accordingly.I will disable such action during processing for programtically setting the checkboxes. No problem there

I would like some help preferrably a smple code snippet in C#, even vb.

Let say the one of the two bound controlsis regexcOptionTextBox

how doI connect the binding manager positon changed to the test event BindingManagerBase_CurrentChanged ?

private bIgnoreChkboxState = false;

private void BindingManagerBase_CurrentChanged(Object sender, EventArgs e )
{

bIgnoreChkboxState = true;
addMsg("@test position Changed");

// .... processing for changing unbound checkboxes....

bIgnoreChkboxState = false;

}

gg1  Thursday, December 20, 2007 7:53 PM

Finally found an answer but does not seem anything to do with BindingManager. just use form events for each control I need to deal with.

in form load event after the initializeComponent

Binding regexoptionBinding = textBoxRegexOptions.DataBindings[0];
regexoptionBinding.Format += new ConvertEventHandler(this.setRegexoptionsChkBoxOnPosnChgd);

and added a convert event

private void setRegexoptionsChkBoxOnPosnChgd(object sender, ConvertEventArgs cevent)
{
addMsg("@@debug in regexBindingSource_positionChanged1 " + cevent.Value);
if ((cevent.Value == DBNull.Value))
{
cevent.Value = "0";
}
else
{
setRegexoptionsChkBox(textBoxRegexOptions.Text);
}
}
gg1  Friday, December 21, 2007 1:15 AM

Finally found an answer but does not seem anything to do with BindingManager. just use form events for each control I need to deal with.

in form load event after the initializeComponent

Binding regexoptionBinding = textBoxRegexOptions.DataBindings[0];
regexoptionBinding.Format += new ConvertEventHandler(this.setRegexoptionsChkBoxOnPosnChgd);

and added a convert event

private void setRegexoptionsChkBoxOnPosnChgd(object sender, ConvertEventArgs cevent)
{
addMsg("@@debug in regexBindingSource_positionChanged1 " + cevent.Value);
if ((cevent.Value == DBNull.Value))
{
cevent.Value = "0";
}
else
{
setRegexoptionsChkBox(textBoxRegexOptions.Text);
}
}
gg1  Friday, December 21, 2007 1:15 AM

You can use google to search for other answers

Custom Search

More Threads

• ProgressBar during a DataBase update
• datagrid check
• DataGridView Rows
• Improve TreeView performance
• DataGridView Vertical ScrollBar
• Sorting unbound table in listbox with drag and drop
• How to use datasets across multiple forms?
• filtering a datagridview
• adding an icon to the datagridviewcolumnheadercell
• Checkbox and Database Update Cellclick Event