using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace ControlGroup
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button[] button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// button1
//
for(int i=0;i<20;i++)
{
this.button1[i] = new System.Windows.Forms.Button();
this.button1[i].Location = new System.Drawing.Point(i * 24 +1,i * 48+1);
this.button1[i].Name = "button1";
this.button1[i].TabIndex = 0;
this.button1[i].Text = "button1";
}
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
for(int i=0;i<20;i++)
{
this.Controls.Add(this.button1[i]);
} this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
//////////////我这里有个错误:
Object reference not set to an instance of an object.请问怎么办?
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace ControlGroup
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button[] button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// button1
//
for(int i=0;i<20;i++)
{
this.button1[i] = new System.Windows.Forms.Button();
this.button1[i].Location = new System.Drawing.Point(i * 24 +1,i * 48+1);
this.button1[i].Name = "button1";
this.button1[i].TabIndex = 0;
this.button1[i].Text = "button1";
}
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
for(int i=0;i<20;i++)
{
this.Controls.Add(this.button1[i]);
} this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
//////////////我这里有个错误:
Object reference not set to an instance of an object.请问怎么办?
解决方案 »
- 继续问下...伸手党的特征...
- 请问网页中XML显示的数据如何抓取?
- 如何把按钮设置透明
- C#与ACCESS问题高手请指导啊谢谢
- 请高手指点:怎么样用API获取窗口的标题栏、边框,然后自定义标题栏边框的外观
- 如何获取一个文件的md5值 C#
- 如何将数据库中的数据提取出来,写到一个Word模板中?
- 急!急!急!在线等。三层调用老是出错。我是个新手
- 类型转换的问题请教
- 爲什麽我刪掉VS.net后,變得程序(exe),不能執行顯示初始化錯誤?
- 问个很菜的问题:什么是托管?什么是回调函数?两者有何联系?
- 傻了!!用SQL语句将一条从网页上摘取下来的信息插入数据库,不明不白的给退出了,啥异常都没有!!!
button1=new Button[20];
for(int i=0;i<20;i++)
{
this.button1[i] = new System.Windows.Forms.Button();
this.button1[i].Location = new System.Drawing.Point(i * 24 +1,i * 48+1);
this.button1[i].Name = "button1";
this.button1[i].TabIndex = 0;
this.button1[i].Text = "button1";
}