Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TextBox.Modified in DataGrid

Status
Not open for further replies.

andrea96

Programmer
Jan 26, 2001
201
US
I am attempting to use some code that I found in this forum to update the DataGrid's DataSource when a cell changes, but the row does not change.

Here is the code.
Code:
Private Sub TextBoxValidating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
    Dim tbc As DataGridTextBoxColumn = _
        CType(dg.TableStyles(0).GridColumnStyles 
        (dg.CurrentCell.ColumnNumber), DataGridTextBoxColumn)

    If Not tbc.TextBox Is Nothing AndAlso tbc.TextBox.Modified Then
        Dim bm As BindingManagerBase = _
            dg.BindingContext(dg.DataSource, dg.DataMember)
        CType(bm.Current, DataRowView).Row.Item(tbc.MappingName) = _ 
            tbc.TextBox.Text
    End If
End Sub

However, tbc.TextBox.Modified is always False, so I am never hitting the code. Am I supposed to set the Modified property at some point, or should it be set automatically?

Thanks for your help,
Andrea
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top