已经在 InitializeComponent() 中初始化这些了为什么最后还要写这么一堆这个?????
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.TextBox textBoxAddress;
private System.Windows.Forms.Label labelOccupatain;
private System.Windows.Forms.Label labelAge;
private System.Windows.Forms.Label labeloutput;
private System.Windows.Forms.TextBox textBoxOutput;
private System.Windows.Forms.TextBox textBoxoccocn;
private System.Windows.Forms.TextBox textBoxage;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonHelp;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.TextBox textBoxAddress;
private System.Windows.Forms.Label labelOccupatain;
private System.Windows.Forms.Label labelAge;
private System.Windows.Forms.Label labeloutput;
private System.Windows.Forms.TextBox textBoxOutput;
private System.Windows.Forms.TextBox textBoxoccocn;
private System.Windows.Forms.TextBox textBoxage;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonHelp;
解决方案 »
- ListView控件,为什么我执行代码后,form1的窗体是白的
- DataRow findrow = ds.Tables["供方进料不合格统计表"].NewRow(); 这种方法为什么不能使用两次
- 大家好啊,能帮帮我吗,我是一个C#初学者
- winform 长时间运行的问题.
- 欢迎加入潮人-编程者QQ群,群号9555936
- (在綫等,馬上揭帖):DataGrid中的DropDownList問題
- treeview 问题,报错如下,根本没有“c:\WINDOWS\assembly\GAC”这个目录。
- winform求助!!
- 关于在C#中将数据导出为dbf文件的问题
- 关于局域网内IP地址问题,请大家进来看一下~~
- 动态添加字段到水晶报表问题?
- 串口数据显示在textbox里
textbox my=new textbox();
//定义
private System.Windows.Forms.TextBox textBoxName;
private void InitializeComponent()
{
this.textbox.Name ="textBoxName"
.....}
是赋予属性
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
textbox my=new textbox();private System.Windows.Forms.Label label2;
这是声明,你要放在InitializeComponent()也行,不过要把里面的this去掉..
----------------------------
可以写成
Textbox my=null;my = Textbox();