1,105,402 Community Members

How to Add event in the dynamic Gridview control?

Member Avatar
nokomoli
Light Poster
26 posts since Nov 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi guys,

i am facing a problem which is i need to create a dynamic gridview control and i need to add eventhandler for this gridview. Therefore, how i add the event?

Member Avatar
GeekByChoiCe
Master Poster
701 posts since Jun 2009
Reputation Points: 152 [?]
Q&As Helped to Solve: 170 [?]
Skill Endorsements: 3 [?]
Featured
 
0
 

are you creating that gridview at runtime?
then your could add a global declaration: Private withevents dataGV as datagridview after this you can already find the events for that control just as all others.
and use it on runtime like: dataGV = new gridview

Member Avatar
__avd
Posting Genius (adatapost)
6,703 posts since Oct 2008
Reputation Points: 1,811 [?]
Q&As Helped to Solve: 1,272 [?]
Skill Endorsements: 61 [?]
Moderator
 
0
 

Use AddHandler and RemoveHandler to add or remove event handlers dynamically.

Member Avatar
Nada_ward
Junior Poster in Training
53 posts since Jul 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

use add handler

ex:

addhandler gridview.click , addressof event

sub event(ByVal sender As System.Object, ByVal e As System.EventArgs)

msgbox("OK")

end sub

suppose the event you want when gridview clicked
and what you want to do put it in another sub

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article