开发者

Handle Click- Events of Dynamically generated buttons..?? VB.NET

HI, Am on creation of touch screen UI system.And am generating button for selecting products

Under certain category.

--> array of button creating dynamically And placing in TABPAGE when user selects Tab for category. The button will be created with the name of products, Under the category selected.

{ 'the way am creating controls. mybutton(j) = new button() mybutton(j).top = 100 }开发者_如何学编程

How can i get the Click event of those buttons-( in the array)....??


You can use the += operator to assign a handler to an event, for example:

myButton.Click += ButtonClick;

and then declare it like this:

public void ButtonClick(object sender, EventArgs e)
{
    // ...
}

Alternatively, if the code is short, you may like to specify it right there directly, for example:

myButton.Click += (sender, e) =>
{
    // ...
}

The advantage of that latter method is that you can capture outside variables, such as for example the array of buttons and the index of this particular button.


Have a look at this link. http://forums.asp.net/p/1583639/3997438.aspx

Add button into the list and create a event for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜