回首 2011-2013:青澀工程師的技術筆記 整理舊文章時,翻到了十多年前自己寫下的一系列 C# 開發筆記。那時候的技術文章沒有什麼溫度,只有一行行冷冰冰的程式碼,以及為了應付各種奇怪錯誤訊息而留下的解法。 現在看來,這些筆記雖然很多已經過時,但卻是那段「與程式碼搏鬥的青春」最真實的紀錄。…
Sample Code 如下: ScrollBar vScrollBar1 = new VScrollBar(); vScrollBar1.Dock = DockStyle.Right; vScrollBar1.Scroll += (sender, e) => { panel1.Verti…
Google之後,找到這篇,   reference: http://www.dotblogs.com.tw/anfernee/archive/2010/07/24/16760.aspx 看來只要設定 Config,取消這一段自動加入的 Request Header 就行…
Hashtable 類別和 Dictionary 泛型類別會實作 IDictionary 介面。 此外,Dictionary 泛型類別還會實作 IDictionary 泛型介面。 因此,這些集合中的每個元素都是一組索引鍵/值組。 Hashtable 物件是由包含集合中元素的 Buck…
public List 歷史記錄List = new List ();         private void 寫檔()         {             int i;             this.歷史記錄List.Add(System.DateTime.Now.ToSt…
1.無條件進位 double s = 100;  int result = 0;  result = Convert.ToInt16(Math.Ceiling(s / 3)); 2,無條件捨去 double s = 100;  int result = 0;  result =Conve…
一直沒發現,每次做Fill時就停在那 原來有事件可以監測一筆一筆的Row 另外要用CommandBuilder的話Select敘述裡面的欄位要包含PrimaryKey或是UniqueKey SqlDataAdapter da = new SqlDataAdapter("放Select敘…
格式 範例 y string yy = DateTime.Now.ToString("y-MM") yy="7-05" yy string yy = DateTime.Now.ToString("yy-MM") yy=&qu…
在有限定時間內自動關閉的 MessageBox。 //Sample Code: using System; using System.Windows.Forms; namespace WindowsApplication1 {     public class Form1: Form     {…
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using Syste…
用戶在使用我們編寫的程式時,難免會出現輸入錯誤的現像,用戶如何知道你輸入的內容是在那個地方出錯了呢? 這裏我們可用ErrorProvider來幫助我們。 我們想實現下圖的效果該如何做呢? 使用ErrorProvider過程如下: 1、定義ErrorProvider 2、使用ErrorPr…
DialogResult myResult = MessageBox.Show ("你要選是還是否?", "顯示在彈出視窗上面的字" , MessageBoxButtons.YesNo, MessageBoxIcon.Question); MessageB…
使用TcpClient 連線時 若是用同步連接, 而對方沒回時要等約23秒才會產生例外 我們可以使用非同步的方式連接, 在我們指定的秒數未回 就直接斷線 TcpClient MyTcpClient = new TcpClient(); IAsyncResult MyResult = My…