Note that there are some explanatory texts on larger screens.

plurals
  1. POdatagridview does not update edit changes
    text
    copied!<p>Im building an bulk insert app to transfer data between Excel to Sql Server in windows forms .net 3.5 The problem is that sometimes excel data need some changes before go to Sql Server, thats why I need create an application with editable datagridview that works like intermediate layer in the process.</p> <p>The application consist in take an excel contents in one datagridview, then I do some validations using backcolor changes, tooltips, etc. So If there are some cells with validations, the user press F2 and changes the respective content.</p> <p>The problem is that when the user ends to change the cell, I want apply again the validation procedure (change backcolor rows, add tooltips, etc) and this does not work anymore, just worked once. In other words, after some changes in datagridview cells, any method for change backcolor of cells does not work. </p> <p>Some ideas? Thanks everyone.</p> <p>Note:</p> <p>This is one of my 4 validate methods:</p> <pre><code>**enter code here** Public Sub Validate() For Each x As DataGridViewRow In DataGridView1.Rows If IsDBNull(x.Cells(0).Value) Then DataGridView1.Rows(x.Index).Cells(0).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(1).Value) Then DataGridView1.Rows(x.Index).Cells(1).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(2).Value) Then DataGridView1.Rows(x.Index).Cells(2).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(3).Value) Then DataGridView1.Rows(x.Index).Cells(3).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(4).Value) Then DataGridView1.Rows(x.Index).Cells(4).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(5).Value) Then DataGridView1.Rows(x.Index).Cells(5).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(6).Value) Then DataGridView1.Rows(x.Index).Cells(6).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(7).Value) Then DataGridView1.Rows(x.Index).Cells(7).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(8).Value) Then DataGridView1.Rows(x.Index).Cells(8).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(9).Value) Then DataGridView1.Rows(x.Index).Cells(9).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(10).Value) Then DataGridView1.Rows(x.Index).Cells(10).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(11).Value) Then DataGridView1.Rows(x.Index).Cells(11).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(12).Value) Then DataGridView1.Rows(x.Index).Cells(12).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(13).Value) Then DataGridView1.Rows(x.Index).Cells(13).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(14).Value) Then DataGridView1.Rows(x.Index).Cells(14).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(15).Value) Then DataGridView1.Rows(x.Index).Cells(15).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(16).Value) Then DataGridView1.Rows(x.Index).Cells(16).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(17).Value) Then DataGridView1.Rows(x.Index).Cells(17).Style.BackColor = Color.Yellow End If If IsDBNull(x.Cells(18).Value) Then DataGridView1.Rows(x.Index).Cells(18).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(19).Value) Then DataGridView1.Rows(x.Index).Cells(19).Style.BackColor = Color.Red End If If IsDBNull(x.Cells(20).Value) Then DataGridView1.Rows(x.Index).Cells(20).Style.BackColor = Color.Red End If Next End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload