Binding to a window Group Box

N

NordeDakota

Question: as per the VS documentation I can bind to a group box, what
is the syntax?

I have the following for checkboxes:
public void BindCheckBox(DataSet myDataSet, string rowCol, CheckBox
ckBox)
{
Binding bind = new Binding("Checked", myDataSet, rowCol, false,
DataSourceUpdateMode.OnPropertyChanged);
ckBox.DataBindings.Add(bind);
}

I can't find any examples for Group Boxes and to know what the
Property Name value parameter is for new Binding()

The problem after this is that I have three radio buttons inside this
Group Box and I would like the data binding to handle the user changes
when they select rb1, rb2, or rb3.

Thanks!
 
K

Ken Foskey

The problem after this is that I have three radio buttons inside this
Group Box and I would like the data binding to handle the user changes
when they select rb1, rb2, or rb3.

I have asked this question before and to the best of my knowledge it is
not possible.

In my case the three buttons come from the database. I simply create the
buttons from there manually and add the database row to the tag. The On
Change event is all the same and I use the database row from the tag to
do something. I set the name to key:

button.Name = String.Format("Category{0}", category.CategoryId);


When I get a row change on the main table I manually get the ID of the
category:

String button = String.Format( "Category{0}",
MyMainTableRow.CategoryRow.CategoryId );

((RadioButton)MyGroupBox.Controls[button]).Checked = true;
 
N

NordeDakota

The problem after this is that I have three radio buttons inside this
Group Box and I would like the data binding to handle the user changes
when they select rb1, rb2, or rb3.

I have asked this question before and to the best of my knowledge it is
not possible.

In my case the three buttons come from the database.  I simply create the
buttons from there manually and add the database row to the tag.  The On
Change event is all the same and I use the database row from the tag to
do something.  I set the name to key:

button.Name = String.Format("Category{0}", category.CategoryId);

When I get a row change on the main table I manually get the ID of the
category:

String button = String.Format( "Category{0}",
MyMainTableRow.CategoryRow.CategoryId );

((RadioButton)MyGroupBox.Controls[button]).Checked = true;

PITTY!!!

I expected as much but I still wanted to get confirmation from someone
else. Thanks for the response.

I'm currenlty handling the UI to datasource manually with a DataView
but I would like to have used the BindingManagerBase. Maybe I'll
handle the Radio Buttons and Group Boxes manually and still use the
BindingManagerBase where I can.

Regards.
 

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

Top