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

📄 confirm.cs

📁 windows mobile 2005 上可以运行的资产管理系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using System.Data;

namespace PDA_test
{
	/// <summary>
	/// confirm 的摘要说明。
	/// </summary>
	public class confirm : System.Windows.Forms.Form
	{
		private string code;
		private string fname="table";


		private System.Windows.Forms.Button CloseButton;
		private PDA_test.ReaderForm mF_Form ;
		private System.Windows.Forms.DataGrid dataGrid1;
		private int timeout;

		private StreamReader lineCount;
		private StreamReader textID;
		private string lc_sql_cmd="";
		private string line;
//		private string[] sArray;

//		private DataTable dt1,dt2;
//		private DataRow dr;
		private DataSet ds;
		private System.Windows.Forms.TextBox textInput;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label totalView;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.Button percentInsert;
		//private DataColumn[] dc;
		private PDA_test.tableFiller tableFiller_start;



		public confirm(ReaderForm myform)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			this.mF_Form  = myform ;

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

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.CloseButton = new System.Windows.Forms.Button();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.textInput = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.totalView = new System.Windows.Forms.Label();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.percentInsert = new System.Windows.Forms.Button();
			// 
			// CloseButton
			// 
			this.CloseButton.Font = new System.Drawing.Font("楷体_GB2312", 18F, System.Drawing.FontStyle.Bold);
			this.CloseButton.Location = new System.Drawing.Point(88, 232);
			this.CloseButton.Size = new System.Drawing.Size(72, 32);
			this.CloseButton.Text = "返回";
			this.CloseButton.Click += new System.EventHandler(this.CloseButton_Click);
			// 
			// dataGrid1
			// 
			this.dataGrid1.Location = new System.Drawing.Point(8, 32);
			this.dataGrid1.Size = new System.Drawing.Size(224, 184);
			this.dataGrid1.Text = "dataGrid1";
			// 
			// textInput
			// 
			this.textInput.Location = new System.Drawing.Point(88, 8);
			this.textInput.Size = new System.Drawing.Size(96, 21);
			this.textInput.Text = "";
			this.textInput.WordWrap = false;
			// 
			// button1
			// 
			this.button1.Font = new System.Drawing.Font("楷体_GB2312", 18F, System.Drawing.FontStyle.Bold);
			this.button1.Location = new System.Drawing.Point(8, 232);
			this.button1.Size = new System.Drawing.Size(72, 32);
			this.button1.Text = "查询";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// totalView
			// 
			this.totalView.Location = new System.Drawing.Point(168, 232);
			this.totalView.Size = new System.Drawing.Size(64, 32);
			// 
			// comboBox1
			// 
			this.comboBox1.Location = new System.Drawing.Point(8, 8);
			this.comboBox1.Size = new System.Drawing.Size(80, 20);
			// 
			// percentInsert
			// 
			this.percentInsert.Location = new System.Drawing.Point(192, 8);
			this.percentInsert.Size = new System.Drawing.Size(24, 16);
			this.percentInsert.Text = "%";
			this.percentInsert.Click += new System.EventHandler(this.percentInsert_Click);
			// 
			// confirm
			// 
			this.Controls.Add(this.percentInsert);
			this.Controls.Add(this.comboBox1);
			this.Controls.Add(this.totalView);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.textInput);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.CloseButton);
			this.Text = "数据查询";
			this.Click += new System.EventHandler(this.confirm_Click);
			this.GotFocus += new System.EventHandler(this.confirm_GotFocus);
			this.Load += new System.EventHandler(this.confirm_Load);

		}
		#endregion

		public void setCode(string code)
		{
			this.code=code;
		}
		private void CloseButton_Click(object sender, System.EventArgs e)
		{
			
			this.mF_Form.Show();
			this.Hide();

			//this.Close();
		}

		private void confirm_Load(object sender, System.EventArgs e)
		{
			
			if(Symbol.Win32.PlatformType == "PocketPC")
			{
				this.Menu = new MainMenu();
			}
			textInput.Focus();
			//StreamReader textID=File.OpenText(fname);
			ds=new DataSet();
			if(ds.Tables.Count==0)
			{
				tableFiller_start=new tableFiller(this);
				tableFiller_start.Show();
			}
//			dt1 = new DataTable();
//			dt2=new DataTable("结果");
//			string line;
//			bool tableread=true;
//
//			try
//			{
//				line=textID.ReadLine();
//				sArray=line.Split('*');
//			}
//			catch(Exception ex)
//			{
//				MessageBox.Show("table读取失败"+ex);
//				tableread=false;
//			}

//			if(tableread)
//			{
//				
//				for(int i=0;i<sArray.Length;i++)
//				{
//					dt1.Columns.Add(sArray[i]);
//					dt2.Columns.Add(sArray[i]);
//					comboBox1.Items.Add(sArray[i]);
//				}
//			}
//			comboBox1.SelectedIndex=1;
//
//			try
//			{
//				while((line = textID.ReadLine()) != null)
//				{
//					sArray=line.Split('*');
//					dr = dt1.NewRow();
//					for(int i=0;i<dr.ItemArray.Length;i++)
//					{
//						dr[i]=sArray[i];
//					}
//					dt1.Rows.Add(dr);
//				}
//				ds = new DataSet();
//				ds.Tables.Add(dt1);
//				ds.Tables.Add(dt2);
//				if (textInput.Text!="")
//					exec_search(textInput.Text);
//				else
//				{
//					//dataGrid1.DataSource=ds.Tables[0];
//					totalView.Text=ds.Tables[0].Rows.Count.ToString();
//				}
//			}
//			catch(Exception ex)
//			{
//				MessageBox.Show("dataGrid构建失败"+ex);
//			}


					
//			dr = dt1.NewRow();
//			dr[0] = "aaa";
//			dr[1] = "bbb";
//			dt1.Rows.Add(dr);
//			
//			ds = new DataSet();
//			ds.Tables.Add(dt1);
//
//			dataGrid1.DataSource=ds.Tables[0];
			//dataGrid1.DataBindings=

			//string pwd_intable="1";
			//string uname="";
			//Boolean IDflag=true;
			
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			exec_search(textInput.Text);
		}
		private void exec_search(string exp)
		{
			//ds.Tables["结果"].Clear();
			DataRow[] resault=ds.Tables["总表"].Select(""+comboBox1.SelectedItem.ToString().Trim()+" like '"+exp.Trim()+"'",""+ds.Tables["总表"].Columns[0].ColumnName+" desc");
			ds.Tables["结果"].Rows.Clear();
			for(int i=0;i<resault.Length;i++)
			{
				ds.Tables["结果"].Rows.Add(resault[i].ItemArray);
			}
			//ds.Tables.Add(dt2);
			totalView.Text="行数:"+ds.Tables["结果"].Rows.Count.ToString();
			dataGrid1.DataSource=ds.Tables["结果"];
		}
		public void dsTrans(DataSet ds)
		{
			this.ds=ds;
		}
		public void comboAdd(string sArray)
		{
			comboBox1.Items.Add(sArray);
		}
		public void comboSelect(int i)
		{
			comboBox1.SelectedIndex=i;
		}
		public void textIn(string exp)
		{
			textInput.Text=exp.Trim();
		}

		private void confirm_GotFocus(object sender, System.EventArgs e)
		{
			textInput.Focus();
		}

		private void confirm_Click(object sender, System.EventArgs e)
		{
			textInput.Focus();
		}

		private void percentInsert_Click(object sender, System.EventArgs e)
		{
			textInput.Text+="%";
			textInput.Focus();
		}
	}
}

⌨️ 快捷键说明

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