Click here to Skip to main content
15,887,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have created an vb.net application and in that i used a DataGridview.But i got an problem is that ,I want the cell textchanged event which is not present in datagridview.So now I added handler as

VB
 AddHandler DataGridView1.EditingControl.TextChanged, AddressOf Dg_TextChanged

Private Sub Dg_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
          MsgBox("Hello")
End Sub


Now the problem is that i want remove the handledler wherever I want ..please help me..

Suppose I removed the handler by

VB
RemoveHandler DataGridView1.CellLeave, AddressOf Dg_TextChanged


still when form texh chnage event occurs it automatically calls the Dg_TextChanged event and I dont want that..
Please help me....
Thank You.
Posted
Updated 5-Jul-11 21:26pm
v2

1 solution

Your TextChanged handler is also set to handle your forms textchanged event, look here

Private Sub Dg_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged.

you should remove that if you want to programmatically add and remove the handler.

Hope this helps
 
Share this answer
 
Comments
Yashodip Jagdale 6-Jul-11 3:29am    
Thank sir..but how to add /remove the forms textchanged event at runtime...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900