Loop through Controls?

  • Thread starter Thread starter Phill
  • Start date Start date
P

Phill

I have a form with several textboxes, checkboxes, and
comboboxes that I want to dynamically databind to a
column in the DataRow being passed in when the form is
intantiated. I have named the fields the same as the
column names that will hold the values. I am stuck.
This is what I have so far. Please help.

public AddPatientForm(DataRow PatientRecord )
{
InitializeComponent();

//Fill with current record
foreach(Control MyControl in this.Controls)
{
//this.FirstName.DataBindings.Add
("Text",PatientRecord[1],null);
}
}
 
Back
Top