473,412 Members | 2,075 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,412 software developers and data experts.

DataGridView Combobox Refresh/Update - VB.NET 2.0

2
I have an unbound datagridview with three comboboxes (e.g. A, B, C) All three comboboxes share the same datasource and use the same valuemember. If I change the value of say combobox A, then B and C change also.

My problem is that B and C do not show the update until after I click off of combobox A. I want B and C to update as soon as I make the selection on A. How do I do this?

Thanks,
Trey

Expand|Select|Wrap|Line Numbers
  1.  
  2.  Private Sub DataGridView1_CellValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
  3.         If Me.Visible = True Then
  4.             Dim ColumnIndex
  5.  
  6.             ColumnIndex = DataGridView1.CurrentCell.ColumnIndex
  7.  
  8.             If ColumnIndex = 2 Then
  9.                 IndexValue = DataGridView1.CurrentRow.Cells(2).Value
  10.                 DataGridView1.CurrentRow.Cells(3).Value = IndexValue
  11.                 DataGridView1.CurrentRow.Cells(4).Value = IndexValue
  12.             End If
  13.  
  14.             If ColumnIndex = 3 Then
  15.                 IndexValue = DataGridView1.CurrentRow.Cells(3).Value
  16.                 DataGridView1.CurrentRow.Cells(2).Value = IndexValue
  17.                 DataGridView1.CurrentRow.Cells(4).Value = IndexValue
  18.             End If
  19.  
  20.             If ColumnIndex = 4 Then
  21.                 IndexValue = DataGridView1.CurrentRow.Cells(4).Value
  22.                 DataGridView1.CurrentRow.Cells(2).Value = IndexValue
  23.                 DataGridView1.CurrentRow.Cells(3).Value = IndexValue
  24.             End If
  25.  
  26.         Else
  27.             Exit Sub
  28.         End If
  29.  
Oct 1 '07 #1
1 10095
Trey
2
It has been resolved. The solution was the last event shown starting on line 31.


Expand|Select|Wrap|Line Numbers
  1.  Private Sub DataGridView1_CellValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
  2.         If Me.Visible = True Then
  3.  
  4.             Dim ColumnIndex
  5.  
  6.             ColumnIndex = DataGridView1.CurrentCell.ColumnIndex
  7.  
  8.             If ColumnIndex = 2 Then
  9.                 IndexValue = DataGridView1.CurrentRow.Cells(2).Value
  10.                 DataGridView1.CurrentRow.Cells(3).Value = IndexValue
  11.                 DataGridView1.CurrentRow.Cells(4).Value = IndexValue
  12.             End If
  13.  
  14.             If ColumnIndex = 3 Then
  15.                 IndexValue = DataGridView1.CurrentRow.Cells(3).Value
  16.                 DataGridView1.CurrentRow.Cells(2).Value = IndexValue
  17.                 DataGridView1.CurrentRow.Cells(4).Value = IndexValue
  18.             End If
  19.  
  20.             If ColumnIndex = 4 Then
  21.                 IndexValue = DataGridView1.CurrentRow.Cells(4).Value
  22.                 DataGridView1.CurrentRow.Cells(2).Value = IndexValue
  23.                 DataGridView1.CurrentRow.Cells(3).Value = IndexValue
  24.             End If
  25.  
  26.         Else
  27.             Exit Sub
  28.         End If
  29.     End Sub
  30.  
  31.     Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
  32.         DataGridView1.CommitEdit(DataGridViewDataErrorContexts.Commit)
  33.     End Sub
  34.  
Oct 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: thomasp | last post by:
This is a two part question, 1) The code below should display a form with a datagridview and a few command buttons. This form should allow the user to make change to the records displayed in...
0
by: Wellington Eliel Lopes | last post by:
Hi people, I have a DataGridView with 3 columns of DataGridViewComboboxColumn type. I need select a different value in the first combobox cell and refresh others columns in relation the first...
6
by: George | last post by:
Hi, I have been encountering a refresh problem with DataGridView, which is bound to a DataTable. When I make updates (Add, Delete, update) to the DataGridView, everything flow nicely to...
0
by: lv2compute | last post by:
I am having a problem with my datagridview. I have a small table that has two columns. The first column is bound to my dataset. The second column is a combobox. I add items to the combobox based on...
3
by: David Cartwright | last post by:
Hi all, I'm having a weird time with a call to the Refresh() method of a DataGridView. I have a VB.NET 2005 Windows application with a main form and a "worker" thread. The main form delegates a...
7
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
3
by: DEC | last post by:
I have a VB application that's about 95% done. As usual, it's that last 5% that's got me stymied. The program is a Bill-of-material update program that interfaces with an SAP database. The BOM's...
1
by: MFayaz | last post by:
Hello! I have to refresh datagridview when database update , IS there any way to solution that my datagridview auto refresh when any user update database. Thanks in Advance
2
by: YouPoP | last post by:
Hi, I have a Window Form to which i added a datagridview. The binding source is working well, but does not update if the database is modified outside the application (i mean not showing the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.