vb.net动态取消控件 vb取消窗体的关闭按钮
vb.net动态生成的button控件如何删除?
uservo user=(uservo)voinfo;
成都创新互联制作网站网页找三站合一网站制作公司,专注于网页设计,成都网站建设、网站设计,网站设计,企业网站搭建,网站开发,建网站业务,680元做网站,已为上千服务,成都创新互联网站建设将一如既往的为我们的客户提供最优质的网站建设、网络营销推广服务!
String username=user.getUsername();
String password=user.getPassword();
System.out.println("your username is "+username);
System.out.println("your password is "+password);
List list = new ArrayList();
vb.net 如何动态彻底删除控件
晕,你把有用的控件选中,然后ctrl+x剪切,再全选窗体内控件,删除!删完了再粘贴!
哈
for each 循环删除控件(vb.net 2003)
因为你在删除的过程中,控件数量改变,导致循环次数不准确,所以才会不完全删除控件
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace WindowsApplication14
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
setLabel(5);
}
private void setLabel(int num)
{
for (int i = 0; i num; i++)
{
Label testLbl = new Label();
testLbl.Text = i.ToString();
this.Controls.Add(testLbl);
testLbl.Top = i * 50;
testLbl.Left = 10;
}
}
private void button1_Click(object sender, EventArgs e)
{
clearLabel(this);
}
private void clearLabel(Control container)
{
for (int i = container.Controls.Count; i 0;i-- )
{
Label lbl = container.Controls[i-1] as Label;
container.Controls.Remove(lbl);
}
}
private void button2_Click(object sender, EventArgs e)
{
setLabel(5);
}
}
}
文章名称:vb.net动态取消控件 vb取消窗体的关闭按钮
当前网址:http://azwzsj.com/article/dooedcj.html