简体   繁体   中英

Adding Events to Dynamically created GridView controls in VB.NET

What I want is do add events to my dynamically created GridView controls in VB.NET. Here is my code.

Dim dgData as New GridView()
dgData.RowDataBound += New GridViewRowEvendHandler(dgData_RowDataBound)

Every time I right the code above I get the blue squiggle line under dgData.RowDataBound and here is the reason:

"Public Event RowDataBound(etc...) is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event"

How can I get rid of the blue squiggle line so I can add my new event handler to this RowDataBound?

Could this be what your looking for? https://stackoverflow.com/a/687293/614263

You need to review Events in VB. It looks like your trying to use C# syntax there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM