Datagrid (windows forms)

G

Guest

is there like a BeforeColumnEdit() or BeforeRowEdit() event in the datagrid.

i want to disable a command button when a row in the grid is dirty. (i.e. a column is being currently edited) and enable it after the Changed() or Validated event fires

i tried the RowChanging(), ColumnChanging() events. but it didnt work.
 
K

Ken Tucker [MVP]

Hi,

I would add a handler to the datagridtextboxcolumns textbox
textchanged and validating events to enable or disable the command buttons.

Dim colName As New DataGridTextBoxColumn

With colName

..MappingName = "LastName"

..HeaderText = "Name"

..Width = 100

End With

AddHandler colName.TextBox.TextChanged, AddressOf TextBox_TextChanged

AddHandler colName.TextBox.Validating, AddressOf TextBox_Validating



Private Sub TextBox_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs)

Debug.WriteLine("Validating")

End Sub

Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

Debug.WriteLine("Text changed")

End Sub



Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top