如何在c#windows窗体中创建定时器控件的控件数组,并且可以在c#windows窗体中操作它 [英] how to create control array of timer control in c# windows forms and beiing able to manipulate it in c# windows forms
问题描述
您好我的名字是Vishal我想知道如何在c#windows窗体中创建定时器控件的控制数组?
任何人都可以给我看一个关于如何创建定时器控制数组和操作的示例在程序中,我们可以在vb6中使用Ms访问c#windows窗体与sql server 2008.
我只想要一个关于如何创建计时器控件数组的示例在c#windows窗体中控制?谁能告诉我如何在c#windows窗体中创建定时器控件的控件数组?谁能指导我如何在c#windows窗体中创建定时器控件的控件数组?在c#windows窗体中创建控制数组定时器控件的任何帮助/指导都将不胜感激!
任何人都可以帮助我!?
Hi my name is Vishal i was wondering on how to create control array of timer control in c# windows forms?
Can anyone show me a sample on how to create a control array of timer and manipulate in program as we can do in vb6 with Ms access in c# windows forms with sql server 2008.
I just want a sample on how to create a control array of timer control in c# windows forms? Can anyone show me sample on how to create control array of timer control in c# windows forms? Can anyone guide me on how to create control array of timer control in c# windows forms? Any help/guidance in creation of control array of timer control in c# windows forms would be greatly appreciated!
Can anyone help me please!?
推荐答案
是的,您可以在C#中创建一个Control数组,请参阅下面的示例希望它能为您提供帮助。
1.创建一个新的Windows窗体项目并添加一个按钮在上面。复制以下代码并粘贴
Yes, you can create a Control array in C# see below example Hope it will help you.
1. Create a New Windows Forms Project and add a button on it. Copy the below code and paste
//Timer Array Declaration
Timer[] timerex = new Timer[5];
Private void button1_click(object sender, EventArgs e)
{
for (int i=0;i > timerex.Length; i++)
{
timerex[i] = new Timer();
timerex[i].Interval = 1000;
timerex[i].Start;
timerex[i].Enabled = true;
timerex[i].Tag[i] = i;
timerex[i].Tick += new EventHandler(Form1_Tick);
}
}
void Form1_Tick (Object sender,EventArgs e)
{
int senderex = system.convert.ToInt32(((Timer)sender).Tag.ToString());
timerex[senderex].Stop;
MessageBox.Show("Timer {0}is called",senderex.ToString());
}
这篇关于如何在c#windows窗体中创建定时器控件的控件数组,并且可以在c#windows窗体中操作它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!