Why datagrid does not change???? Help Me Please!

A

AliRezaGoogle

Dear members,
I have a datagrid and a textbox on my form.
I bound both of them to a common datasource( an arbitrary datatable).

When I change a text inside textbox I expect that value of same column
in datagride also change and be equal to new value entered inside
textbox.

But this change reflects to datagrid just when I change selected row
in the datagrid.
Another way of reflecting changes is hiding then showing the datagrid
which can be done by a few line of by codes.

Is there any way to reflect changes immediatly when textbox text is
changed ( or even after validating)

Bests,
 
N

Nicholas Paldino [.NET/C# MVP]

I would advise against updating the data bindings for each change in the
textbox. This will cause every character entered to change the data grid,
which isn't a bad thing, but updating the bindings constantly like that is
probably going to impact how fast text can be entered into the textbox.

Regardless, if this is what you wanted, you could always hook up to the
TextChanged event and refresh the bindings manually (through the
BindingContext).
 

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