如何创建动态按钮与学生从数据库卷号 [英] How to Create Dynamic Buttons With Students Roll No. on It From Database

查看:78
本文介绍了如何创建动态按钮与学生从数据库卷号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿朋友....



我有一个名字表(Student_Table)

字段(Stdid,StdRollNo,StuName)

共有5条记录





和窗口表格名称表格1



现在,我的问题是..

我希望动态按钮等于学生记录,即... 5个按钮,

我想要的按钮学生卷号





请各位帮助我

解决方案

设置循环遍历每个学生卷号,并在循环中:

按钮b = 按钮(); 
b.Text = rollNo.ToString();
b.Click + = new EventHandler(MyDynamicButton_Click);
b.Location = new Point(x,y);
y + = 30 ;
Controls.Add(b);

其中x和y是你的起始坐标。


hey Friends....

I have a Table with Name (Student_Table)
fields(Stdid, StdRollNo, StuName)
with 5 records


And A windows Form With Name Form1

Now, My question is..
I want Dynamic Buttons equals to students records ie.. 5 buttons,
on That Buttons i want Student Roll No.


please guys help me

解决方案

Set up a loop to go through each student roll no, and in the loop:

Button b = new Button();
b.Text = rollNo.ToString();
b.Click += new EventHandler(MyDynamicButton_Click);
b.Location = new Point(x, y);
y += 30;
Controls.Add(b);

Where x and y are your starting coordinates.


这篇关于如何创建动态按钮与学生从数据库卷号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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