| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6853 人关注过本帖
标题:求助!!!未将对象引用设置到对象的实例。 我哭死了
只看楼主 加入收藏
tongle
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-6-29
收藏
 问题点数:0 回复次数:10 
求助!!!未将对象引用设置到对象的实例。 我哭死了

这是我写的一个程序,大家帮忙看看呀 using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Data.SqlClient;

namespace tongle { /// <summary> /// Form8 的摘要说明。 /// </summary> public class Form8 : System.Windows.Forms.Form { private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.DataGrid dataGrid1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.TabPage tabPage5; private System.Windows.Forms.Label label1; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton3; private System.Windows.Forms.RadioButton radioButton4; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBox4; private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox textBox5; private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox textBox6; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox textBox7; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Label label10; private System.Windows.Forms.TextBox textBox8; private System.Windows.Forms.Button button5; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox textBox9; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox textBox10; private System.Windows.Forms.Label label13; private System.Windows.Forms.TextBox textBox11; private System.Windows.Forms.Label label14; private System.Windows.Forms.TextBox textBox12; private System.Windows.Forms.Label label15; private System.Windows.Forms.TextBox textBox13; private System.Windows.Forms.Label label16; private System.Windows.Forms.TextBox textBox14; private System.Windows.Forms.Label label17; private System.Windows.Forms.TextBox textBox15; private System.Windows.Forms.Button button6; private BindingManagerBase Navigator; private System.Windows.Forms.Label label18; private System.Windows.Forms.TextBox textBox16; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button12; private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; private System.Data.SqlClient.SqlCommand sqlSelectCommand1; private System.Data.SqlClient.SqlCommand sqlInsertCommand1; private System.Data.SqlClient.SqlCommand sqlUpdateCommand1; private System.Data.SqlClient.SqlCommand sqlDeleteCommand1; private System.Data.SqlClient.SqlConnection sqlConnection1; private tongle.DataSet1 dataSet11; private System.Data.SqlClient.SqlCommand sqlCommand1; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null;

public Form8() { // // Windows 窗体设计器支持所必需的 // InitializeComponent();

// // TOD 在 InitializeComponent 调用后添加任何构造函数代码 // }

/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// private void ExecuteSql(string StringSQL) { try { string MyConStr="server=Localhost;Integrated Security=SSPI;Initial Catalog=tongle"; sqlConnection1.ConnectionString=MyConStr; try { this.sqlCommand1.CommandText=StringSQL; this.sqlCommand1.CommandType= CommandType.Text; this.sqlCommand1.Connection=this.sqlConnection1; this.sqlConnection1.Open(); //sqlCommand1.CommandText="SELECT * from goods"; this.textBox16.Text=this.Navigator.Count.ToString(); this.sqlDataAdapter1.SelectCommand=sqlCommand1; this.dataSet11.Clear(); this.sqlDataAdapter1.Fill(this.dataSet11,"goods"); } catch(Exception ex) { MessageBox.Show(ex.Message,"错误!"); }; } finally { if(sqlConnection1.State==ConnectionState.Open) sqlConnection1.Close(); }

} protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); }

#region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.textBox16 = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); this.button4 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.button3 = new System.Windows.Forms.Button(); this.textBox7 = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.textBox6 = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.textBox5 = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.textBox4 = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.textBox3 = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.button12 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.button7 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.textBox8 = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.button8 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.textBox10 = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.textBox11 = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); this.textBox12 = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); this.textBox13 = new System.Windows.Forms.TextBox(); this.label16 = new System.Windows.Forms.Label(); this.textBox14 = new System.Windows.Forms.TextBox(); this.label17 = new System.Windows.Forms.Label(); this.textBox15 = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.textBox9 = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.dataSet11 = new tongle.DataSet1(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlCommand1 = new System.Data.SqlClient.SqlCommand(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage3.SuspendLayout(); this.tabPage2.SuspendLayout(); this.tabPage4.SuspendLayout(); this.tabPage5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); this.SuspendLayout();

搜索更多相关主题的帖子: 实例 对象 设置 
2005-06-29 20:41
tongle
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-6-29
收藏
得分:0 
//
   // tabControl1
   //
   this.tabControl1.Controls.Add(this.tabPage1);
   this.tabControl1.Controls.Add(this.tabPage3);
   this.tabControl1.Controls.Add(this.tabPage2);
   this.tabControl1.Controls.Add(this.tabPage4);
   this.tabControl1.Controls.Add(this.tabPage5);
   this.tabControl1.Location = new System.Drawing.Point(0, 0);
   this.tabControl1.Name = "tabControl1";
   this.tabControl1.SelectedIndex = 0;
   this.tabControl1.Size = new System.Drawing.Size(400, 376);
   this.tabControl1.TabIndex = 0;
   //
   // tabPage1
   //
   this.tabPage1.Controls.Add(this.textBox16);
   this.tabPage1.Controls.Add(this.label18);
   this.tabPage1.Controls.Add(this.button4);
   this.tabPage1.Controls.Add(this.label1);
   this.tabPage1.Location = new System.Drawing.Point(4, 21);
   this.tabPage1.Name = "tabPage1";
   this.tabPage1.Size = new System.Drawing.Size(392, 351);
   this.tabPage1.TabIndex = 0;
   this.tabPage1.Text = "开始";
   this.tabPage1.Click += new System.EventHandler(this.tabPage1_Click);
   //
   // textBox16
   //
   this.textBox16.Location = new System.Drawing.Point(120, 208);
   this.textBox16.Name = "textBox16";
   this.textBox16.TabIndex = 3;
   this.textBox16.Text = "";
   //
   // label18
   //
   this.label18.Location = new System.Drawing.Point(8, 208);
   this.label18.Name = "label18";
   this.label18.TabIndex = 2;
   this.label18.Text = "总物品数";
   this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // button4
   //
   this.button4.Location = new System.Drawing.Point(272, 224);
   this.button4.Name = "button4";
   this.button4.TabIndex = 1;
   this.button4.Text = "返回";
   this.button4.Click += new System.EventHandler(this.button4_Click);
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(32, 64);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(320, 96);
   this.label1.TabIndex = 0;
   this.label1.Text = "label1";
   //
   // tabPage3
   //
   this.tabPage3.Controls.Add(this.button3);
   this.tabPage3.Controls.Add(this.textBox7);
   this.tabPage3.Controls.Add(this.label9);
   this.tabPage3.Controls.Add(this.textBox6);
   this.tabPage3.Controls.Add(this.label8);
   this.tabPage3.Controls.Add(this.textBox5);
   this.tabPage3.Controls.Add(this.label7);
   this.tabPage3.Controls.Add(this.textBox4);
   this.tabPage3.Controls.Add(this.label6);
   this.tabPage3.Controls.Add(this.textBox3);
   this.tabPage3.Controls.Add(this.label5);
   this.tabPage3.Controls.Add(this.textBox2);
   this.tabPage3.Controls.Add(this.label4);
   this.tabPage3.Location = new System.Drawing.Point(4, 21);
   this.tabPage3.Name = "tabPage3";
   this.tabPage3.Size = new System.Drawing.Size(392, 351);
   this.tabPage3.TabIndex = 2;
   this.tabPage3.Text = "添加物品";
   //
   // button3
   //
   this.button3.Location = new System.Drawing.Point(272, 232);
   this.button3.Name = "button3";
   this.button3.Size = new System.Drawing.Size(80, 24);
   this.button3.TabIndex = 12;
   this.button3.Text = "添加";
   this.button3.Click += new System.EventHandler(this.button3_Click);
   //
   // textBox7
   //
   this.textBox7.Location = new System.Drawing.Point(288, 152);
   this.textBox7.Name = "textBox7";
   this.textBox7.Size = new System.Drawing.Size(112, 21);
   this.textBox7.TabIndex = 11;
   this.textBox7.Text = "";
   //
   // label9
   //
   this.label9.Location = new System.Drawing.Point(192, 152);
   this.label9.Name = "label9";
   this.label9.Size = new System.Drawing.Size(88, 23);
   this.label9.TabIndex = 10;
   this.label9.Text = "记录人姓名";
   //
   // textBox6
   //
   this.textBox6.Location = new System.Drawing.Point(80, 152);
   this.textBox6.Name = "textBox6";
   this.textBox6.Size = new System.Drawing.Size(104, 21);
   this.textBox6.TabIndex = 9;
   this.textBox6.Text = "";
   //
   // label8
   //
   this.label8.Location = new System.Drawing.Point(16, 152);
   this.label8.Name = "label8";
   this.label8.Size = new System.Drawing.Size(48, 23);
   this.label8.TabIndex = 8;
   this.label8.Text = "价格";
   //
   // textBox5
   //
   this.textBox5.Location = new System.Drawing.Point(288, 96);
   this.textBox5.Name = "textBox5";
   this.textBox5.Size = new System.Drawing.Size(104, 21);
   this.textBox5.TabIndex = 7;
   this.textBox5.Text = "";
   //
   // label7
   //
   this.label7.Location = new System.Drawing.Point(208, 96);
   this.label7.Name = "label7";
   this.label7.Size = new System.Drawing.Size(72, 23);
   this.label7.TabIndex = 6;
   this.label7.Text = "欲使用年限";
   this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox4
   //
   this.textBox4.Location = new System.Drawing.Point(88, 96);
   this.textBox4.Name = "textBox4";
   this.textBox4.TabIndex = 5;
   this.textBox4.Text = "";
   //
   // label6
   //
   this.label6.Location = new System.Drawing.Point(16, 96);
   this.label6.Name = "label6";
   this.label6.Size = new System.Drawing.Size(56, 23);
   this.label6.TabIndex = 4;
   this.label6.Text = "购入时间";
   this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox3
   //
   this.textBox3.Location = new System.Drawing.Point(280, 32);
   this.textBox3.Name = "textBox3";
   this.textBox3.Size = new System.Drawing.Size(112, 21);
   this.textBox3.TabIndex = 3;
   this.textBox3.Text = "";
   //
   // label5
   //
   this.label5.Location = new System.Drawing.Point(200, 32);
   this.label5.Name = "label5";
   this.label5.Size = new System.Drawing.Size(72, 23);
   this.label5.TabIndex = 2;
   this.label5.Text = "物品名称";
   this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox2
   //
   this.textBox2.Location = new System.Drawing.Point(88, 32);
   this.textBox2.Name = "textBox2";
   this.textBox2.TabIndex = 1;
   this.textBox2.Text = "";
   //
   // label4
   //
   this.label4.Location = new System.Drawing.Point(16, 32);
   this.label4.Name = "label4";
   this.label4.Size = new System.Drawing.Size(56, 23);
   this.label4.TabIndex = 0;
   this.label4.Text = "物品编号";
   this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // tabPage2
   //
   this.tabPage2.Controls.Add(this.button12);
   this.tabPage2.Controls.Add(this.button11);
   this.tabPage2.Controls.Add(this.button10);
   this.tabPage2.Controls.Add(this.button9);
   this.tabPage2.Controls.Add(this.textBox1);
   this.tabPage2.Controls.Add(this.label3);
   this.tabPage2.Controls.Add(this.button2);
   this.tabPage2.Controls.Add(this.button1);
   this.tabPage2.Controls.Add(this.label2);
   this.tabPage2.Controls.Add(this.radioButton4);
   this.tabPage2.Controls.Add(this.radioButton3);
   this.tabPage2.Controls.Add(this.radioButton2);
   this.tabPage2.Controls.Add(this.radioButton1);
   this.tabPage2.Location = new System.Drawing.Point(4, 21);
   this.tabPage2.Name = "tabPage2";
   this.tabPage2.Size = new System.Drawing.Size(392, 351);
   this.tabPage2.TabIndex = 1;
   this.tabPage2.Text = "查找物品";
   //
   // button12
   //
   this.button12.Location = new System.Drawing.Point(168, 224);
   this.button12.Name = "button12";
   this.button12.Size = new System.Drawing.Size(64, 23);
   this.button12.TabIndex = 12;
   this.button12.Text = "下一条";
   this.button12.Click += new System.EventHandler(this.button12_Click);
   //
   // button11
   //
   this.button11.Location = new System.Drawing.Point(40, 232);
   this.button11.Name = "button11";
   this.button11.Size = new System.Drawing.Size(56, 23);
   this.button11.TabIndex = 11;
   this.button11.Text = "上一条";
   this.button11.Click += new System.EventHandler(this.button11_Click);
   //
   // button10
   //
   this.button10.Location = new System.Drawing.Point(96, 264);
   this.button10.Name = "button10";
   this.button10.Size = new System.Drawing.Size(64, 23);
   this.button10.TabIndex = 10;
   this.button10.Text = "尾记录";
   this.button10.Click += new System.EventHandler(this.button10_Click);
   //
   // button9
   //
   this.button9.Location = new System.Drawing.Point(104, 192);
   this.button9.Name = "button9";
   this.button9.Size = new System.Drawing.Size(56, 23);
   this.button9.TabIndex = 9;
   this.button9.Text = "首记录";
   this.button9.Click += new System.EventHandler(this.button9_Click);
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(168, 144);
   this.textBox1.Name = "textBox1";
   this.textBox1.TabIndex = 8;
   this.textBox1.Text = "";
   //
   // label3
   //
   this.label3.Location = new System.Drawing.Point(24, 144);
   this.label3.Name = "label3";
   this.label3.Size = new System.Drawing.Size(104, 24);
   this.label3.TabIndex = 7;
   this.label3.Text = "请输入查询值";
   this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(264, 256);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(96, 24);
   this.button2.TabIndex = 6;
   this.button2.Text = "显示全部记录";
   this.button2.Click += new System.EventHandler(this.button2_Click);
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(264, 200);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(96, 23);
   this.button1.TabIndex = 5;
   this.button1.Text = "查询";
   this.button1.Click += new System.EventHandler(this.button1_Click_1);
   //
   // label2
   //
   this.label2.Location = new System.Drawing.Point(16, 16);
   this.label2.Name = "label2";
   this.label2.TabIndex = 4;
   this.label2.Text = "请选择查询类型";
   this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // radioButton4
   //
   this.radioButton4.Location = new System.Drawing.Point(24, 96);
   this.radioButton4.Name = "radioButton4";
   this.radioButton4.Size = new System.Drawing.Size(128, 24);
   this.radioButton4.TabIndex = 3;
   this.radioButton4.Text = "按购入时间查询";
   //
   // radioButton3
   //
   this.radioButton3.Location = new System.Drawing.Point(216, 56);
   this.radioButton3.Name = "radioButton3";
   this.radioButton3.Size = new System.Drawing.Size(120, 24);
   this.radioButton3.TabIndex = 2;
   this.radioButton3.Text = "按物品名称查询";
   //
   // radioButton2
   //
   this.radioButton2.Location = new System.Drawing.Point(24, 56);
   this.radioButton2.Name = "radioButton2";
   this.radioButton2.Size = new System.Drawing.Size(136, 24);
   this.radioButton2.TabIndex = 1;
   this.radioButton2.Text = "按物品编号查询";
   //
   // radioButton1
   //
   this.radioButton1.Location = new System.Drawing.Point(216, 88);
   this.radioButton1.Name = "radioButton1";
   this.radioButton1.Size = new System.Drawing.Size(152, 24);
   this.radioButton1.TabIndex = 0;
   this.radioButton1.Text = "按记录人查询";
   //

爷爷的 我被骗了
2005-06-29 20:42
tongle
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-6-29
收藏
得分:0 
   // tabPage4
   //
   this.tabPage4.Controls.Add(this.button7);
   this.tabPage4.Controls.Add(this.button5);
   this.tabPage4.Controls.Add(this.textBox8);
   this.tabPage4.Controls.Add(this.label10);
   this.tabPage4.Location = new System.Drawing.Point(4, 21);
   this.tabPage4.Name = "tabPage4";
   this.tabPage4.Size = new System.Drawing.Size(392, 351);
   this.tabPage4.TabIndex = 3;
   this.tabPage4.Text = "删除物品";
   //
   // button7
   //
   this.button7.Location = new System.Drawing.Point(128, 200);
   this.button7.Name = "button7";
   this.button7.Size = new System.Drawing.Size(88, 23);
   this.button7.TabIndex = 3;
   this.button7.Text = "显示该条信息";
   this.button7.Click += new System.EventHandler(this.button7_Click);
   //
   // button5
   //
   this.button5.Location = new System.Drawing.Point(240, 200);
   this.button5.Name = "button5";
   this.button5.Size = new System.Drawing.Size(104, 23);
   this.button5.TabIndex = 2;
   this.button5.Text = "删除";
   this.button5.Click += new System.EventHandler(this.button5_Click);
   //
   // textBox8
   //
   this.textBox8.Location = new System.Drawing.Point(112, 104);
   this.textBox8.Name = "textBox8";
   this.textBox8.TabIndex = 1;
   this.textBox8.Text = "";
   //
   // label10
   //
   this.label10.Location = new System.Drawing.Point(32, 48);
   this.label10.Name = "label10";
   this.label10.Size = new System.Drawing.Size(128, 23);
   this.label10.TabIndex = 0;
   this.label10.Text = "欲删除的记录编号";
   this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // tabPage5
   //
   this.tabPage5.Controls.Add(this.button8);
   this.tabPage5.Controls.Add(this.button6);
   this.tabPage5.Controls.Add(this.textBox10);
   this.tabPage5.Controls.Add(this.label13);
   this.tabPage5.Controls.Add(this.textBox11);
   this.tabPage5.Controls.Add(this.label14);
   this.tabPage5.Controls.Add(this.textBox12);
   this.tabPage5.Controls.Add(this.label15);
   this.tabPage5.Controls.Add(this.textBox13);
   this.tabPage5.Controls.Add(this.label16);
   this.tabPage5.Controls.Add(this.textBox14);
   this.tabPage5.Controls.Add(this.label17);
   this.tabPage5.Controls.Add(this.textBox15);
   this.tabPage5.Controls.Add(this.label12);
   this.tabPage5.Controls.Add(this.textBox9);
   this.tabPage5.Controls.Add(this.label11);
   this.tabPage5.Location = new System.Drawing.Point(4, 21);
   this.tabPage5.Name = "tabPage5";
   this.tabPage5.Size = new System.Drawing.Size(392, 351);
   this.tabPage5.TabIndex = 4;
   this.tabPage5.Text = "修改记录";
   //
   // button8
   //
   this.button8.Location = new System.Drawing.Point(168, 248);
   this.button8.Name = "button8";
   this.button8.TabIndex = 24;
   this.button8.Text = "提交";
   this.button8.Click += new System.EventHandler(this.button8_Click);
   //
   // button6
   //
   this.button6.Location = new System.Drawing.Point(264, 248);
   this.button6.Name = "button6";
   this.button6.TabIndex = 23;
   this.button6.Text = "修改";
   this.button6.Click += new System.EventHandler(this.button6_Click);
   //
   // textBox10
   //
   this.textBox10.Location = new System.Drawing.Point(264, 168);
   this.textBox10.Name = "textBox10";
   this.textBox10.Size = new System.Drawing.Size(104, 21);
   this.textBox10.TabIndex = 22;
   this.textBox10.Text = "";
   //
   // label13
   //
   this.label13.Location = new System.Drawing.Point(192, 168);
   this.label13.Name = "label13";
   this.label13.Size = new System.Drawing.Size(72, 23);
   this.label13.TabIndex = 21;
   this.label13.Text = "记录人姓名";
   //
   // textBox11
   //
   this.textBox11.Location = new System.Drawing.Point(72, 168);
   this.textBox11.Name = "textBox11";
   this.textBox11.Size = new System.Drawing.Size(104, 21);
   this.textBox11.TabIndex = 20;
   this.textBox11.Text = "";
   //
   // label14
   //
   this.label14.Location = new System.Drawing.Point(16, 176);
   this.label14.Name = "label14";
   this.label14.Size = new System.Drawing.Size(48, 23);
   this.label14.TabIndex = 19;
   this.label14.Text = "价格";
   //
   // textBox12
   //
   this.textBox12.Location = new System.Drawing.Point(264, 128);
   this.textBox12.Name = "textBox12";
   this.textBox12.Size = new System.Drawing.Size(104, 21);
   this.textBox12.TabIndex = 18;
   this.textBox12.Text = "";
   //
   // label15
   //
   this.label15.Location = new System.Drawing.Point(184, 120);
   this.label15.Name = "label15";
   this.label15.Size = new System.Drawing.Size(72, 23);
   this.label15.TabIndex = 17;
   this.label15.Text = "欲使用年限";
   this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox13
   //
   this.textBox13.Location = new System.Drawing.Point(72, 128);
   this.textBox13.Name = "textBox13";
   this.textBox13.TabIndex = 16;
   this.textBox13.Text = "";
   //
   // label16
   //
   this.label16.Location = new System.Drawing.Point(8, 128);
   this.label16.Name = "label16";
   this.label16.Size = new System.Drawing.Size(56, 23);
   this.label16.TabIndex = 15;
   this.label16.Text = "购入时间";
   this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox14
   //
   this.textBox14.Location = new System.Drawing.Point(264, 80);
   this.textBox14.Name = "textBox14";
   this.textBox14.Size = new System.Drawing.Size(112, 21);
   this.textBox14.TabIndex = 14;
   this.textBox14.Text = "";
   //
   // label17
   //
   this.label17.Location = new System.Drawing.Point(184, 80);
   this.label17.Name = "label17";
   this.label17.Size = new System.Drawing.Size(72, 23);
   this.label17.TabIndex = 13;
   this.label17.Text = "物品名称";
   this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox15
   //
   this.textBox15.Location = new System.Drawing.Point(72, 80);
   this.textBox15.Name = "textBox15";
   this.textBox15.TabIndex = 12;
   this.textBox15.Text = "";
   //
   // label12
   //
   this.label12.Location = new System.Drawing.Point(8, 80);
   this.label12.Name = "label12";
   this.label12.Size = new System.Drawing.Size(56, 23);
   this.label12.TabIndex = 2;
   this.label12.Text = "物品编号";
   this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // textBox9
   //
   this.textBox9.Location = new System.Drawing.Point(216, 32);
   this.textBox9.Name = "textBox9";
   this.textBox9.TabIndex = 1;
   this.textBox9.Text = "";
   //
   // label11
   //
   this.label11.Location = new System.Drawing.Point(24, 32);
   this.label11.Name = "label11";
   this.label11.Size = new System.Drawing.Size(120, 24);
   this.label11.TabIndex = 0;
   this.label11.Text = "欲修改的记录编号";
   this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   //
   // dataGrid1
   //
   this.dataGrid1.DataMember = "";
   this.dataGrid1.DataSource = this.dataSet11.goods;
   this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
   this.dataGrid1.Location = new System.Drawing.Point(400, 0);
   this.dataGrid1.Name = "dataGrid1";
   this.dataGrid1.Size = new System.Drawing.Size(544, 376);
   this.dataGrid1.TabIndex = 1;
   //
  

爷爷的 我被骗了
2005-06-29 20:43
tongle
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-6-29
收藏
得分:0 
// dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN"); // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "goods", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("记录编号", "记录编号"), new System.Data.Common.DataColumnMapping("物品编号", "物品编号"), new System.Data.Common.DataColumnMapping("物品价格", "物品价格"), new System.Data.Common.DataColumnMapping("购入时间", "购入时间"), new System.Data.Common.DataColumnMapping("使用年限", "使用年限"), new System.Data.Common.DataColumnMapping("记录人", "记录人"), new System.Data.Common.DataColumnMapping("物品名称", "物品名称")})}); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = @"DELETE FROM goods WHERE (ID = @Original_记录编号) AND (name = @Original_物品名称 OR @Original_物品名称 IS NULL AND name IS NULL) AND (name2 = @Original_记录人 OR @Original_记录人 IS NULL AND name2 IS NULL) AND (number = @Original_物品编号 OR @Original_物品编号 IS NULL AND number IS NULL) AND (price = @Original_物品价格 OR @Original_物品价格 IS NULL AND price IS NULL) AND (time1 = @Original_购入时间 OR @Original_购入时间 IS NULL AND time1 IS NULL) AND (time2 = @Original_使用年限 OR @Original_使用年限 IS NULL AND time2 IS NULL)"; this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_记录编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "记录编号", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物品名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物品名称", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_记录人", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "记录人", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物品编号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物品编号", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物品价格", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物品价格", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_购入时间", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "购入时间", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_使用年限", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "使用年限", System.Data.DataRowVersion.Original, null)); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "workstation id=CHANGTAO;packet size=4096;user id=qiky;integrated security=SSPI;da" + "ta source=CHANGTAO;persist security info=False;initial catalog=tongle"; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = @"INSERT INTO goods(number, price, time1, time2, name2, name) VALUES (@number, @price, @time1, @time2, @name2, @name); SELECT ID AS 记录编号, number AS 物品编号, price AS 物品价格, time1 AS 购入时间, time2 AS 使用年限, name2 AS 记录人, name AS 物品名称 FROM goods WHERE (ID = @@IDENTITY)"; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@number", System.Data.SqlDbType.VarChar, 10, "物品编号")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@price", System.Data.SqlDbType.VarChar, 10, "物品价格")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@time1", System.Data.SqlDbType.DateTime, 8, "购入时间")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@time2", System.Data.SqlDbType.VarChar, 10, "使用年限")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name2", System.Data.SqlDbType.VarChar, 10, "记录人")); this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar, 10, "物品名称")); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT ID AS 记录编号, number AS 物品编号, price AS 物品价格, time1 AS 购入时间, time2 AS 使用年限, n" + "ame2 AS 记录人, name AS 物品名称 FROM goods"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = @"UPDATE goods SET number = @number, price = @price, time1 = @time1, time2 = @time2, name2 = @name2, name = @name WHERE (ID = @Original_记录编号) AND (name = @Original_物品名称 OR @Original_物品名称 IS NULL AND name IS NULL) AND (name2 = @Original_记录人 OR @Original_记录人 IS NULL AND name2 IS NULL) AND (number = @Original_物品编号 OR @Original_物品编号 IS NULL AND number IS NULL) AND (price = @Original_物品价格 OR @Original_物品价格 IS NULL AND price IS NULL) AND (time1 = @Original_购入时间 OR @Original_购入时间 IS NULL AND time1 IS NULL) AND (time2 = @Original_使用年限 OR @Original_使用年限 IS NULL AND time2 IS NULL); SELECT ID AS 记录编号, number AS 物品编号, price AS 物品价格, time1 AS 购入时间, time2 AS 使用年限, name2 AS 记录人, name AS 物品名称 FROM goods WHERE (ID = @记录编号)"; this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@number", System.Data.SqlDbType.VarChar, 10, "物品编号")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@price", System.Data.SqlDbType.VarChar, 10, "物品价格")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@time1", System.Data.SqlDbType.DateTime, 8, "购入时间")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@time2", System.Data.SqlDbType.VarChar, 10, "使用年限")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name2", System.Data.SqlDbType.VarChar, 10, "记录人")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@name", System.Data.SqlDbType.VarChar, 10, "物品名称")); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_记录编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "记录编号", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物品名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物品名称", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_记录人", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "记录人", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物品编号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物品编号", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_物品价格", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "物品价格", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_购入时间", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "购入时间", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_使用年限", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "使用年限", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@记录编号", System.Data.SqlDbType.Int, 4, "记录编号")); // // sqlCommand1 // this.sqlCommand1.Connection = this.sqlConnection1; // // Form8 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(784, 334); this.Controls.Add(this.dataGrid1); this.Controls.Add(this.tabControl1); this.Name = "Form8"; this.Text = "物品管理平台"; this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage3.ResumeLayout(false); this.tabPage2.ResumeLayout(false); this.tabPage4.ResumeLayout(false); this.tabPage5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); this.ResumeLayout(false);

} #endregion


爷爷的 我被骗了
2005-06-29 20:43
tongle
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-6-29
收藏
得分:0 
private void button1_Click_1(object sender, System.EventArgs e) { if(radioButton1.Checked==true) { string SelStr="select * from goods where name2='"+textBox1.Text+"'"; ExecuteSql(SelStr); } else if (radioButton2.Checked==true) { string SelStr="select * from goods where number='"+textBox1.Text+"'"; ExecuteSql(SelStr); } else if (radioButton3.Checked==true) { string SelStr="select * from goods where name='"+textBox1.Text+"'"; ExecuteSql(SelStr); } else if (radioButton4.Checked==true) { string SelStr="select * from goods where time1='"+textBox1.Text+"'"; ExecuteSql(SelStr); } else { MessageBox.Show("您必须选择一个查询类型!"); }

}

private void button4_Click(object sender, System.EventArgs e) { Form2 aform=new Form2(); aform.Show(); this.Visible=false; }

private void button6_Click(object sender, System.EventArgs e) { if(this.textBox9.Text=="") { MessageBox.Show("必须输入信息记录编号才能进行修改!"); return; } else { string UpStr="Update goods set number='"+textBox15.Text+"',name='"+textBox14.Text+"',price='"+textBox11.Text+"',time1='"+textBox13.Text+"',time2='"+textBox12.Text+"',name2='"+textBox10.Text+"'where ID='"+textBox9.Text+"'"; ExecuteSql(UpStr); } }

private void button8_Click(object sender, System.EventArgs e) { string SelStr="select * from goods where ID='"+textBox9.Text+"'"; string strConn="server=Localhost;Integrated Security=SSPI;Initial Catalog=tongle"; SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString=strConn; SqlCommand myCommand=new SqlCommand(SelStr,myConnection); myConnection.Open(); //myCommand.Connection.Open(); //myCommand.ExecuteNonQuery(); //dataSet11.Clear(); //sqlDataAdapter1.Fill(dataSet11,"信件管理系统"); SqlDataReader dr=myCommand.ExecuteReader(); while(dr.Read()) { this.textBox15.Text=dr.GetValue(1).ToString(); this.textBox11.Text=dr.GetValue(2).ToString(); this.textBox13.Text=dr.GetValue(3).ToString(); this.textBox12.Text=dr.GetValue(4).ToString(); this.textBox10.Text=dr.GetValue(5).ToString(); this.textBox14.Text=dr.GetValue(6).ToString(); }

myCommand.Connection.Close(); myConnection.Close(); }

private void button12_Click(object sender, System.EventArgs e) { if(this.Navigator.Position==this.Navigator.Count-1) { this.Navigator.Position=0; } else { this.Navigator.Position+=1; } }

private void button11_Click(object sender, System.EventArgs e) { if(this.Navigator.Position==0) { this.Navigator.Position=this.Navigator.Count-1;} else { this.Navigator.Position-=1; } }

private void button10_Click(object sender, System.EventArgs e) { this.Navigator.Position=this.Navigator.Count-1; }

private void button9_Click(object sender, System.EventArgs e) { try { this.Navigator.Position=0; } catch(Exception ex) { MessageBox.Show(ex.Message); } }

private void button2_Click(object sender, System.EventArgs e) { dataSet11.Clear(); sqlDataAdapter1.Fill(dataSet11,"goods"); }

private void sqlConnection1_InfoMessage(object sender, System.Data.SqlClient.SqlInfoMessageEventArgs e) { }

private void button3_Click(object sender, System.EventArgs e) { string Instr="insert into goods values('"+textBox2.Text+"','"+textBox3.Text+"','"+textBox6.Text+"','"+textBox4.Text+"','"+textBox5.Text+"','"+textBox7.Text+"')"; ExecuteSql(Instr); }

private void button5_Click(object sender, System.EventArgs e) { if (this.textBox8.Text=="") { MessageBox.Show("必须输入记录编号才能进行操作!"); return; } else{ string DelStr="delete from goods where ID= '"+textBox8.Text +"'"; ExecuteSql(DelStr); } }

private void button7_Click(object sender, System.EventArgs e) { this.Navigator.Position=Int32.Parse(textBox8.Text)-1; }

private void tabPage1_Click(object sender, System.EventArgs e) { }

} }以下是调试报告: “DefaultDomain”: 已加载“c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll”,未加载符号。 “tongle”: 已加载“F:\作业\tongle\bin\Debug\tongle.exe”,符号已加载。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.windows.forms\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.thunk.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\mscorlib.resources\1.0.5000.0_zh-chs_b77a5c561934e089\mscorlib.resources.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.windows.forms.resources\1.0.5000.0_zh-chs_b77a5c561934e089\system.windows.forms.resources.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.data.resources\1.0.5000.0_zh-chs_b77a5c561934e089\system.data.resources.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\accessibility\1.0.5000.0__b03f5f7f11d50a3a\accessibility.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.resources\1.0.5000.0_zh-chs_b77a5c561934e089\system.resources.dll”,未加载符号。 未处理的“System.NullReferenceException”类型的异常出现在 tongle.exe 中。

其他信息: 未将对象引用设置到对象的实例。

未处理的异常: System.NullReferenceException: 未将对象引用设置到对象的实例。 at tongle.Form8.button7_Click(Object sender, EventArgs e) in f:\作业\tongle\form8.cs:line 1006 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at tongle.Form1.Main() in f:\作业\tongle\form1.cs:line 210程序“[2120] tongle.exe”已退出,返回值为 0 (0x0)。


爷爷的 我被骗了
2005-06-29 20:44
tongle
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-6-29
收藏
得分:0 
以下是调试报告: “DefaultDomain”: 已加载“c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll”,未加载符号。 “tongle”: 已加载“F:\作业\tongle\bin\Debug\tongle.exe”,符号已加载。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.windows.forms\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.thunk.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\mscorlib.resources\1.0.5000.0_zh-chs_b77a5c561934e089\mscorlib.resources.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.windows.forms.resources\1.0.5000.0_zh-chs_b77a5c561934e089\system.windows.forms.resources.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.data.resources\1.0.5000.0_zh-chs_b77a5c561934e089\system.data.resources.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\accessibility\1.0.5000.0__b03f5f7f11d50a3a\accessibility.dll”,未加载符号。 “tongle.exe”: 已加载“c:\windows\assembly\gac\system.resources\1.0.5000.0_zh-chs_b77a5c561934e089\system.resources.dll”,未加载符号。 未处理的“System.NullReferenceException”类型的异常出现在 tongle.exe 中。

其他信息: 未将对象引用设置到对象的实例。

未处理的异常: System.NullReferenceException: 未将对象引用设置到对象的实例。 at tongle.Form8.button7_Click(Object sender, EventArgs e) in f:\作业\tongle\form8.cs:line 1006 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at tongle.Form1.Main() in f:\作业\tongle\form1.cs:line 210程序“[2120] tongle.exe”已退出,返回值为 0 (0x0)。


爷爷的 我被骗了
2005-06-29 20:45
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
同志,你就摆一大版代码出来不给点注释啊!BindingManagerBase是干什么用的啊?(我感觉好像是个集合)

寻求挑战,追求完美 Oh,my god!
2005-07-01 21:30
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
哎..我看了下资料...BindingManagerBase没有一个返回实例的方法,你也没有用new申请内存啊!(BindingManagerBase是抽象类,又不是实值类型的,你不用new它肯定会丢E啦,所以就造成了null的参考了)

寻求挑战,追求完美 Oh,my god!
2005-07-01 21:33
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
看样子你是新手吧?NullReferenceException这么重要的异常还没玩好

寻求挑战,追求完美 Oh,my god!
2005-07-01 21:39
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
哦对啦,告诉你,抽象类要先继承后new

寻求挑战,追求完美 Oh,my god!
2005-07-03 10:43
快速回复:求助!!!未将对象引用设置到对象的实例。 我哭死了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021037 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved