473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataBinding to DataGridView AND TextBoxes?

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(DataGridViewDataErrorCo ntexts.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

Sep 14 '06 #1
1 1424
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" <pi****************@hotmail.comschreef in bericht
news:Oo****************@TK2MSFTNGP06.phx.gbl...
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(DataGridViewDataErrorCo ntexts.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

Sep 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeff | last post by:
I am having a behaviour problem with Databinding on a C# WinForm. I have three textboxes and a Checkbox bound to a dataset. The desired behaviour is when I check/uncheck the checkbox, I want to...
1
by: Dave A | last post by:
Hi, I am struggling with two way databinding in WinForms and the DataGridView. I am binding to business object classes (rather than datatables). If I have a collection of these business...
5
by: Uncle Sammy | last post by:
Hey all, I am trying to use a Listbox control with two data bindings. I cannot get the listbox to change the textboxes. Here's the code: using System; using System.Collections.Generic;...
2
by: Rich | last post by:
Hello, Following an example at http://www.vb-tips.com/dbpages.aspx?IA=DG (by Cor Lightert and Ken Tucker) on binding a dataRelation to a Datagridview for sqlClient, I was able to view rows...
1
by: Pieter | last post by:
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...
2
by: snowdog17 | last post by:
Hello, I am a student and I need help with my VB task. I am currently using VB 2005 Express and I am fairly new to it, although I have programed in Delphi before....
0
by: CSharpie1000 | last post by:
I am sorry for the broadness of this question, but I litterally can't get anywhere with this. I have a dataGridView that loads data from an Access 2007 Database. This works fine. I would like...
4
by: John Wright | last post by:
I have set up a datagrid on my form with six columns. I want to capture the data from six textboxes on the form and add them to the datagrid. All the info I can find about this is with datatables...
4
by: thesti | last post by:
hello, how to make a datagridview to select no row after i bind it datasource to a datatable. i have this code in my form load myDGView.DataSource = myDataTable then when the form load,...
1
by: mzahid | last post by:
Hellow All I am new in ASP.Net Application. I have a page with some TextBoxes and GridView. I have Done the Values of Textboxes save into Invoice Table and i want to save Invoice Detail values...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.