Solved

Updating a datagridcolumn once excel lookup has been modified

Posted on 2014-03-26
3
106 Views
Last Modified: 2014-07-21
with using
thisgrid.Rows(i).Cells("columnName").value and an excel lookup

I am able to right click on the dataGrid and click edit Excel spreadsheet for this grid.
Once I make a change to the excel spreadsheet I want the dataGrid to update immediately without having to close and reopen.

I am using .cellvaluechanged and . cellclick events

What is the procedure to do this?
0
Comment
Question by:taviaf
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39957323
You can call the code that binds the grid to rebind it.
0
 

Author Comment

by:taviaf
ID: 39957751
@CodeCruiser, what do you mean? And how... The grid gets its data on the cellvaluechanged event of another tab...



 Private Sub controlEventComboBox_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles gridTab1.CellValueChanged
.
.
.

For Each thisEvent In mLookupRecords.ExcelList

                If Trim(UCase(thisEvent.ProbeEvent)) = Trim(UCase(probeEvents)) Then
                    gridTab2.Rows.Add()
                    gridTab2.Rows(gridTab2.RowCount - 1).Cells("csdnamonnumber").Value = gridTab1.Rows(e.RowIndex).Cells("controleventmonnumber").Value
                    gridTab2.Rows(gridTab2.RowCount - 1).Cells("csProbeDescription").Value = thisEvent.Description
                End If
            Next
...
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39961216
Move this code into a method. Call that method from the combobox_cellvaluechanged event as well as where you need to refresh it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now