Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo

  Datagrid (windows forms) (Thursday, January 26, 2006)




Found the following interesting discussion in the Newsgroups:

Datagrid (windows forms)
by:Anonymous

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.

 Reply:
by: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







 
Previous Posts
    - Master details grid remove the cross
    - Unicode/international
    - SQLDMO error in .NET
    - Can't write to the event log
    - Communication
    - Crystal report
    - api call using struct*
    - Custom message loop
    - Newline in a datatable column
    - Embed dll

Archives
    - 2006-01-01
    - 2006-01-08
    - 2006-01-15
    - 2006-01-22
    - 2006-01-29


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland