DataBinding to DataGridView AND TextBoxes?

P

Pieter

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
 
C

Cor Ligthert [MVP]

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
 

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