Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > row error
 

row error

hi, i tried all combinations possible, i get the hasErrors to work only when there is more than 1 record in tb1. for the first record i add and press save, it goes into msgbox no. how can i refresh or somthing?

Private Sub Save(ByVal e As Object, ByVal er As EventArgs) Handles mySave.Click

CompareTwoGridsForEquality()

CompareCompleteness_of_grid2()

checkCompletenessOfallRowsInGrid1()

If Me.ds.Tables(Me.tb1name).HasErrors Then

MsgBox("yes")

Else : MsgBox("no")

End If

End Sub

hrubesh  Monday, September 18, 2006 12:47 PM

It works if i press save twice., thats the full code for the section why is that? it only get the errrors on the second try.

Private Sub Save(ByVal e As Object, ByVal er As EventArgs) Handles mySave.Click

' CompareTwoGridsForEquality()

'CompareCompleteness_of_grid2()

checkCompletenessOfallRowsInGrid1()

If Me.ds.Tables(Me.tb1name).GetErrors.Length > 0 Then

MsgBox("yes")

Else : MsgBox("no")

End If

End Sub

Private Sub checkCompletenessOfallRowsInGrid1()

Dim arRow(Me.DetailedInvoiceDGV.RowCount - 1) As DataGridViewRow

Me.DetailedInvoiceDGV.Rows.CopyTo(arRow, 0)

Array.ForEach(arRow, AddressOf verifyCompleteness)

End Sub

Private Sub verifyCompleteness(ByVal t As DataGridViewRow)

Dim arRow(t.Cells.Count - 1) As DataGridViewCell

t.Cells.CopyTo(arRow, 0)

Array.ForEach(arRow, AddressOf verifyEachCell)

End Sub

Private Sub verifyEachCell(ByVal c As DataGridViewCell)

Try

If IsDBNull(c.Value) Then

c.ErrorText = "Missing Text"

CType(c.OwningRow.DataBoundItem, DataRowView).Row.RowError = "Row Error"

Else

c.ErrorText = Nothing

End If

Catch ex As Exception

MsgBox(ex.Message)

CType(c.OwningRow.DataBoundItem, DataRowView).Row.RowError = "Row Error"

End Try

End Sub

hrubesh  Monday, September 18, 2006 1:05 PM

And this workss!!! thats stupid now.whats happenning here wat am i missing?? ouput is no then yes.

If Me.ds.Tables(Me.tb1name).HasErrors Then

MsgBox("yes")

Else : MsgBox("no")

End If

If Me.ds.Tables(Me.tb1name).HasErrors Then

MsgBox("yes")

Else : MsgBox("no")

End If

hrubesh  Monday, September 18, 2006 1:11 PM

You can use google to search for other answers

Custom Search

More Threads

• Need to add two textboxes in a single datagridcolumn
• Bind GridViewColumn Order
• Sorting a DataGridView Programatically
• deep clone datagridviewColumn
• DataGridView ComboBoxColumn problem
• Specifying child and parent co,lumns in DataRelation Object
• Open a form to a specific record using the Text (value) of a Label as the value to use to find the record
• HOW TO INSERT,DELETE AND UPDATE IN DATABSE THROUTH DATAGRIDVIEW (VISUAL BASIC 2005)
• ComboBox reloading
• Deployment: Security question