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?
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
Use AddHandler and RemoveHandler to add or remove event handlers dynamically.
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.