Hello,
I have a tabcontrol with 4 tabpages with some textboxes on each tabpage.These textboxes are binded to a datatable.All the data appears well in each textbox but when i want to access the text property of the textboxes alle the values are empty except the text propertys on tabpage 1?Why is that?
Here is some code:
public partial class Form1 : Form
{
public DataSet ds = new DataSet();
public DataTable dt = new DataTable();
public BindingSource binding1 = new BindingSource();
public Form1()
{
InitializeComponent();
toolStripProgressBar1.Maximum = 10;
toolStripProgressBar1.Minimum = 0;
toolStripProgressBar1.Value = 0;
toolStripProgressBar1.Step = 1;
try
{
string connectString = "Persist Security Info=False;User ID=gerry;Password=3600gerry;Initial Catalog=BROEKX_038951_311;Data Source=webdata99.broekx.be";
string sql = "Select * From [038951_311_PERSON_PERSON]";
using (SqlConnection connection = new SqlConnection(connectString))
{
connection.Open();
SqlDataAdapter dataAdapter1 = new SqlDataAdapter(sql, connection);
dataAdapter1.Fill(ds,
"038951_311_PERSON_PERSON");
dt = ds.Tables[
"038951_311_PERSON_PERSON"];
binding1.DataSource = dt;
connection.Close();
}
}
catch (SqlException sqlex)
{
MessageBox.Show(sqlex.Message, "Error");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error");
}
}
public partial class Personeel : Form
{
Form1 frm1 = (Form1)Application.OpenForms["Form1"];
public
Personeel()
{
InitializeComponent();
bindingNavigator2.BindingSource = frm1.binding1;
}
private
void VulTextboxen()
{
this
.textBox1.DataBindings.Add(new Binding("Text", frm1.binding1, "AFKORTING", true));
this.textBox2.DataBindings.Add(new Binding("Text", frm1.binding1, "NAAM", true));
this
.textBox38.DataBindings.Add(new Binding("Text", frm1.binding1, "PLAAT", true));
this.textBox49.DataBindings.Add(new Binding("Text", frm1.binding1, "BURGSTAND", true));
}
so textbox 1 and 2 are on tabpage 1 and have a text property but textbox 38 and 49 are on tabpage 4 and have empty text property.
Hope someone can help
greetings, gerry