1.建立打包專案

Array.Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length);
dataGridView1[0, 0].Value = "1"; dataGridView1[1, 0].Value = "2"; dataGridView1[0, 1].Value = "3";或
dataGridView1.Rows[0].Cells[0].Value = "1"; dataGridView1.Rows[0].Cells[1].Value = "2"; dataGridView1.Rows[1].Cells[0].Value = "3";
dataGridView1.DefaultCellStyle.Font = New Font("Arial", 9);
OpenFileDialog openFileDialog1 = new OpenFileDialog(); /*Sets the file dialog box title.*/ openFileDialog1.Title = "Select *.txt"; /*Sets the initial directory displayed by the file dialog box.*/ openFileDialog1.InitialDirectory = "..\\Setting\\"; /*Sets the current file name filter string.*/ openFileDialog1.Filter = "dat files (*.*)|*.txt"; /*Runs a common dialog box with a default owner.*/ if (openFileDialog1.ShowDialog() == DialogResult.OK) { /*Provides a Stream for a file*/ FileStream filestream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read); /*Initializes a new instance of the StreamReader class for the specified stream.*/ StreamReader sr = new StreamReader(filestream); /*選一種方式讀出*/ #if(true) /*一次讀完全部*/ textBox1.Text = sr.ReadToEnd(); #else /*一次讀一行*/ string line; int lineCounter = 0; while((line = sr.ReadLine()) != null) { textBox1.Text += line; /*計算總共有幾行*/ lineCounter++; } #endif }
private void btn1_Click(object sender, EventArgs e) { int value = 10; textBox2.Text = Convert.ToString(value, 16); }