?? tablefiller.cs
字號(hào):
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>
/// tableFiller 的摘要說明。
/// </summary>
public class tableFiller : System.Windows.Forms.Form
{
private PDA_test.confirm mF_Form;
private DataRow dr;
private DataSet ds;
private string fname="table";
private System.Windows.Forms.ProgressBar progressBar1;
private string[] sArray;
private DataTable dt1,dt2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
public tableFiller(confirm myform)
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
this.mF_Form = myform;
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(16, 40);
this.progressBar1.Size = new System.Drawing.Size(192, 24);
//
// label1
//
this.label1.Location = new System.Drawing.Point(40, 72);
this.label1.Size = new System.Drawing.Size(152, 16);
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// button1
//
this.button1.Font = new System.Drawing.Font("楷體_GB2312", 15.75F, System.Drawing.FontStyle.Bold);
this.button1.Location = new System.Drawing.Point(56, 88);
this.button1.Size = new System.Drawing.Size(104, 32);
this.button1.Text = "確 定";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
//
// tableFiller
//
this.ClientSize = new System.Drawing.Size(224, 128);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.progressBar1);
this.Text = "tableFiller";
this.Load += new System.EventHandler(this.tableFiller_Load);
}
#endregion
private void tableFiller_Load(object sender, System.EventArgs e)
{
StreamReader textID=File.OpenText(fname);
StreamReader textID2=File.OpenText(fname);
dt1 = new DataTable("總表");
dt2 = new DataTable("結(jié)果");
string line;
bool tableread=true;
int lineCount=0;
while((line = textID2.ReadLine()) != null)
{
lineCount++;
}
textID2.Close();
try
{
line=textID.ReadLine();
sArray=line.Split('*');
}
catch(IOException 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]);
mF_Form.comboAdd(sArray[i].ToString().Trim());
}
mF_Form.comboSelect(1);
}
//comboBox1.SelectedIndex=1;
progressBar1.Minimum=0;
progressBar1.Maximum=lineCount;
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);
progressBar1.Value++;
}
textID.Close();
ds = new DataSet();
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
mF_Form.dsTrans(ds);
}
catch(Exception ex)
{
MessageBox.Show("dataGrid構(gòu)建失敗"+ex);
}
}
private void button1_Click(object sender, System.EventArgs e)
{
//mF_Form.Show();
this.Close();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -