⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 golddlg.cs

📁 用c#写的房源管理软件。刚开始学C#
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.OleDb ; 
namespace HoursInfo
{
	/// <summary>
	/// GoldDlg 的摘要说明。
	/// </summary>
	public class GoldDlg : System.Windows.Forms.Form
	{
		OleDbDataReader reader;
		string strCommand;
		bool m_Control;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.DateTimePicker zutime;
		private System.Data.OleDb.OleDbConnection oleDbConnection1;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.Button Add;
		private System.Windows.Forms.Button delete;
		private System.Windows.Forms.Button findInfo;
		private System.Windows.Forms.Button Amend;
		private System.Windows.Forms.Button deleteAll;
		private System.Windows.Forms.Button ShowAll;
		private System.Windows.Forms.TextBox HoursPos;
		private System.Windows.Forms.TextBox hoursNum;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.TextBox GetGold;
		private System.Windows.Forms.TextBox hezuo;
		private System.Windows.Forms.TextBox findhezuo;
		private System.Windows.Forms.DateTimePicker beginTime;
		private System.Windows.Forms.DateTimePicker EndTime;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public GoldDlg()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			hoursNum.Enabled = false;
			//
			// 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.label1 = new System.Windows.Forms.Label();
			this.HoursPos = new System.Windows.Forms.TextBox();
			this.GetGold = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.hezuo = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.zutime = new System.Windows.Forms.DateTimePicker();
			this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
			this.label5 = new System.Windows.Forms.Label();
			this.hoursNum = new System.Windows.Forms.TextBox();
			this.listView1 = new System.Windows.Forms.ListView();
			this.Add = new System.Windows.Forms.Button();
			this.delete = new System.Windows.Forms.Button();
			this.findInfo = new System.Windows.Forms.Button();
			this.Amend = new System.Windows.Forms.Button();
			this.deleteAll = new System.Windows.Forms.Button();
			this.ShowAll = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.EndTime = new System.Windows.Forms.DateTimePicker();
			this.label6 = new System.Windows.Forms.Label();
			this.beginTime = new System.Windows.Forms.DateTimePicker();
			this.label7 = new System.Windows.Forms.Label();
			this.findhezuo = new System.Windows.Forms.TextBox();
			this.label8 = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 88);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "合作对象:";
			// 
			// HoursPos
			// 
			this.HoursPos.Location = new System.Drawing.Point(80, 112);
			this.HoursPos.Name = "HoursPos";
			this.HoursPos.Size = new System.Drawing.Size(584, 21);
			this.HoursPos.TabIndex = 1;
			this.HoursPos.Text = "";
			// 
			// GetGold
			// 
			this.GetGold.Location = new System.Drawing.Point(80, 144);
			this.GetGold.Name = "GetGold";
			this.GetGold.Size = new System.Drawing.Size(120, 21);
			this.GetGold.TabIndex = 3;
			this.GetGold.Text = "";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(16, 152);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "收取金额:";
			// 
			// hezuo
			// 
			this.hezuo.Location = new System.Drawing.Point(80, 80);
			this.hezuo.Name = "hezuo";
			this.hezuo.Size = new System.Drawing.Size(480, 21);
			this.hezuo.TabIndex = 5;
			this.hezuo.Text = "";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 120);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(72, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "房屋名称:";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(224, 152);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(72, 16);
			this.label4.TabIndex = 6;
			this.label4.Text = "租售时间:";
			// 
			// zutime
			// 
			this.zutime.Location = new System.Drawing.Point(288, 144);
			this.zutime.Name = "zutime";
			this.zutime.Size = new System.Drawing.Size(120, 21);
			this.zutime.TabIndex = 116;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(440, 152);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(48, 16);
			this.label5.TabIndex = 117;
			this.label5.Text = "编号:";
			// 
			// hoursNum
			// 
			this.hoursNum.Location = new System.Drawing.Point(476, 144);
			this.hoursNum.Name = "hoursNum";
			this.hoursNum.Size = new System.Drawing.Size(76, 21);
			this.hoursNum.TabIndex = 118;
			this.hoursNum.Text = "";
			// 
			// listView1
			// 
			this.listView1.Location = new System.Drawing.Point(8, 176);
			this.listView1.Name = "listView1";
			this.listView1.Size = new System.Drawing.Size(840, 328);
			this.listView1.TabIndex = 119;
			this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
			// 
			// Add
			// 
			this.Add.Location = new System.Drawing.Point(592, 80);
			this.Add.Name = "Add";
			this.Add.TabIndex = 120;
			this.Add.Text = "增加";
			this.Add.Click += new System.EventHandler(this.Add_Click);
			// 
			// delete
			// 
			this.delete.Location = new System.Drawing.Point(672, 80);
			this.delete.Name = "delete";
			this.delete.TabIndex = 121;
			this.delete.Text = "删除";
			this.delete.Click += new System.EventHandler(this.delete_Click);
			// 
			// findInfo
			// 
			this.findInfo.Location = new System.Drawing.Point(752, 24);
			this.findInfo.Name = "findInfo";
			this.findInfo.TabIndex = 123;
			this.findInfo.Text = "查询";
			this.findInfo.Click += new System.EventHandler(this.findInfo_Click);
			// 
			// Amend
			// 
			this.Amend.Location = new System.Drawing.Point(752, 80);
			this.Amend.Name = "Amend";
			this.Amend.TabIndex = 122;
			this.Amend.Text = "修改";
			this.Amend.Click += new System.EventHandler(this.Amend_Click);
			// 
			// deleteAll
			// 
			this.deleteAll.Location = new System.Drawing.Point(752, 112);
			this.deleteAll.Name = "deleteAll";
			this.deleteAll.TabIndex = 125;
			this.deleteAll.Text = "删除全部";
			this.deleteAll.Click += new System.EventHandler(this.deleteAll_Click);
			// 
			// ShowAll
			// 
			this.ShowAll.Location = new System.Drawing.Point(672, 112);
			this.ShowAll.Name = "ShowAll";
			this.ShowAll.TabIndex = 124;
			this.ShowAll.Text = "列出全部";
			this.ShowAll.Click += new System.EventHandler(this.ShowAll_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.beginTime);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.findInfo);
			this.groupBox1.Controls.Add(this.EndTime);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.findhezuo);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(840, 64);
			this.groupBox1.TabIndex = 126;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "帐目查询";
			// 
			// EndTime
			// 
			this.EndTime.Location = new System.Drawing.Point(632, 24);
			this.EndTime.Name = "EndTime";
			this.EndTime.Size = new System.Drawing.Size(112, 21);
			this.EndTime.TabIndex = 128;
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(568, 29);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(72, 16);
			this.label6.TabIndex = 127;
			this.label6.Text = "结束时间:";
			// 
			// beginTime
			// 
			this.beginTime.Location = new System.Drawing.Point(432, 24);
			this.beginTime.Name = "beginTime";
			this.beginTime.Size = new System.Drawing.Size(112, 21);
			this.beginTime.TabIndex = 130;
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(368, 29);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(72, 16);
			this.label7.TabIndex = 129;
			this.label7.Text = "开始时间:";
			// 
			// findhezuo
			// 
			this.findhezuo.Location = new System.Drawing.Point(72, 24);
			this.findhezuo.Name = "findhezuo";
			this.findhezuo.Size = new System.Drawing.Size(272, 21);
			this.findhezuo.TabIndex = 128;
			this.findhezuo.Text = "";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(8, 29);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(72, 16);
			this.label8.TabIndex = 127;
			this.label8.Text = "合作对象:";
			// 
			// GoldDlg
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(856, 510);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.deleteAll);
			this.Controls.Add(this.ShowAll);
			this.Controls.Add(this.Amend);
			this.Controls.Add(this.delete);
			this.Controls.Add(this.Add);
			this.Controls.Add(this.listView1);
			this.Controls.Add(this.hoursNum);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.zutime);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.hezuo);
			this.Controls.Add(this.GetGold);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.HoursPos);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.label3);
			this.MaximizeBox = false;
			this.MaximumSize = new System.Drawing.Size(864, 544);
			this.MinimizeBox = false;
			this.MinimumSize = new System.Drawing.Size(864, 544);
			this.Name = "GoldDlg";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "查帐\\入单";
			this.Load += new System.EventHandler(this.GoldDlg_Load);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void GoldDlg_Load(object sender, System.EventArgs e)
		{
			listView1.GridLines = true ;//显示各个记录的分隔线 
			listView1.FullRowSelect = true ; //要选择就是一行 
			listView1.View = View.Details ; //定义列表显示的方式 
			listView1.Scrollable = true ; //需要时候显示滚动条 
			listView1.MultiSelect = true ; // false为不可以多行选择,true为可以多行选择 
			listView1.HeaderStyle = ColumnHeaderStyle.Nonclickable ; 
			// 针对数据库的字段名称,建立与之适应显示表头 
			listView1.Columns.Add ( "编号" , 40 , HorizontalAlignment.Left ); 
			listView1.Columns.Add ( "合作对象" ,300 , HorizontalAlignment.Left ); 
			listView1.Columns.Add ( "房屋信息" , 300 , HorizontalAlignment.Left ); 
			listView1.Columns.Add ( "收取金额" , 100 , HorizontalAlignment.Left ); 
			listView1.Columns.Add ( "租售时间" , 96, HorizontalAlignment.Left ); 
			listView1.Visible = true ;

			oleDbConnection1.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+ Application.StartupPath+"\\矢量工作站.mdb";
			Console.Write (oleDbConnection1.ConnectionString.ToString()); 
			m_Control = true;
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -