DataBinding to DataGridView AND TextBoxes?

DataBinding to DataGridView AND TextBoxes?

Post by Piete » Fri, 15 Sep 2006 19:33:11


Hi,

My problem:
When the cursor is on a given row in the DataGridView, the data in the row
has to be shown in TextBoxes underneath the DataGridView. the user must be
able to edit in the Datagridview, or in the textboxes. The text in these
textboxes and the datagridview has to be synchronsied at all time. So if the
user types "a" in the Name-Column, the "a" has to appear immediately in the
Textbox etc.

This doesn't seem to be as easy as I thought. I used a BindingSource, and I
handle the EditingControlShowing_TextChanged-event of my DataGridView, and
in that handler I force commits after each keypress
(Me.dgvArticles.CommitEdit(DataGridViewDataErrorContexts.Commit) ) and do a
ResetCurrentItem of my BindingSource. But this doesn't work always, not when
it's the first time a suer selects a row etc etc etc...

So: a lot of trouble, and still not the desired result.

Does anybody knows how to do this? I would help me really a lot!

Thanks a lot in advance,

Pieter
 
 
 

DataBinding to DataGridView AND TextBoxes?

Post by Cor Ligthe » Sat, 16 Sep 2006 13:24:14

Pieter,

In my idea "forget it", if you succeed (by catching by instance the paint
events) you will see that you ends up with a terrible slow solution because
you are repainting every time a keystroke on more places which will because
of the catch of the paint event have to be investigated from where they
come.

Did you ever see this in by instance something as Excel. I would be sure
that they did it if this was a reachable solution.

Just my thought,

Cor

"Pieter" < XXXX@XXXXX.COM > schreef in bericht