databinding in form conctructor

T

tomse

Hello,
a strange, but probably simple, problem drives me nuts:
I have simple databinding of textbox to bindingsource(bound to
dataset), created in form constructor:

public Form3(string xyz)
{
InitializeComponent();

Program.bs.AddNew();
textBox1.DataBindings.Add("Text", Program.bs, "cmType");

textBox1.Text = xyz; // <-nothing happens
}

all I want is to add a new row to dataset, and set a value of column
"cmType" programatically in form constructor. Problem is that result of
program above is blank textBox1, and no data in "cmType".
If i fill textBox1 in onFormShow event, everything goes ok.
Anyone can help?
thx
 

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