处理按钮单击的WinForm的DataRepeater C#移动电源 [英] Handle Button Click in WinForm DataRepeater C# Power Pack

查看:171
本文介绍了处理按钮单击的WinForm的DataRepeater C#移动电源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想处理DataRepeater中的winform点击按钮,我该怎么办呢?所有的按钮都放在一个的DataRepeater

i want to handle winform button click in the DataRepeater, how can i do it? all button are placed in a DataRepeater

非常感谢你。

推荐答案

在Visual Studio设计,双击按钮,然后你会得到空的事件处理方法。
添加代码那里。

In visual studio designer, double click the button then you get the empty eventhandler method. Add code there.

您可以通过CURRENTITEM或CurrentItemIndex当前项目获得哪个按钮被点击...

You can get the current item via CurrentItem or CurrentItemIndex to get which button was clicked...

    private void button1_Click(object sender, EventArgs e)
    {
        Console.WriteLine("DEBUG: CurrentItem: " + dataRepeater1.CurrentItem);
        Console.WriteLine("DEBUG: CurrentItemIndex: " + dataRepeater1.CurrentItemIndex);
    }

这篇关于处理按钮单击的WinForm的DataRepeater C#移动电源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆