<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;DUIDQHY9eip7ImA9WxBSFEo.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261</id><updated>2009-12-22T18:26:11.862+08:00</updated><title>hi Sam 隨堂筆記</title><subtitle type='html'>C#,SQL,Powerbuilder,軟體,心情,生活</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default?redirect=false&amp;v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry gd:etag='W/&quot;C0EASHg8fSp7ImA9WxBSEU8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-6294553575090313189</id><published>2009-12-18T15:34:00.000+08:00</published><updated>2009-12-18T15:34:09.675+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-12-18T15:34:09.675+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>讓中文字長度等於2</title><summary>系統環境：C# 2005

由於客戶需要相容舊系統資料的關係
必須把中文字的長度算2
但在Unicode的架構下中文字的長度都是1

不過在C#下其實蠻簡單的
稍微轉個型就好
看程式碼
   1:  byte[] bytestr = Encoding.Default.GetBytes(textBox2.Text); //把string轉為byte   2:  label2.Text = bytestr.Length.ToString(); //取byte的長度, 中文字就會算2碼了


下載範例：[Code]</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/6294553575090313189/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/12/2.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/6294553575090313189?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/6294553575090313189?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/12/2.html' title='讓中文字長度等於2'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_OxD_FZv7El8/Sysvd7j8CiI/AAAAAAAAAGc/ZDGQeKRd0K8/s72-c/string2byte.png' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CkQNRnw9eip7ImA9WxNaEUk.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-5947506624873946488</id><published>2009-11-25T10:19:00.003+08:00</published><updated>2009-11-25T17:13:17.262+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-25T17:13:17.262+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>模擬MSN的震動視窗</title><summary>系統環境：C# 2005

在一個迴圈內亂數改變左上角的位置就可以了
看程式碼
   1:  private void button1_Click(object sender, EventArgs e)   2:  {   3:      Point now_p = this.Location;   4:      Random r = new Random();   5:      6:      for (int i = 0; i &lt; 50; i++)   7:      {   8:          Point new_p = new Point(now_p.X + r.Next(-10, 10), now_p.Y + r.Next(-10, 10)); //新的位置   9:          this.Location = new_p;  10:          </summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/5947506624873946488/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/msn.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5947506624873946488?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5947506624873946488?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/msn.html' title='模擬MSN的震動視窗'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;Ck4DQ3w8fCp7ImA9WxNUGEk.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-3778730379695171320</id><published>2009-11-10T13:54:00.005+08:00</published><updated>2009-11-10T16:16:12.274+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-10T16:16:12.274+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>當TextBox.Enabled為false時, 改變字體顏色</title><summary>系統環境：C# 2005

通常設TextBox.Enabled為false時
系統會很自動的幫你改掉前景&amp;背景色
像這樣：



但在老舊的螢幕上看這樣的顏色是非常吃力的 (幾乎看不到字了)
所以User希望字可以改成黑色
但實際下這樣的指令會發現
是沒有效果的：
   1:  textBox1.Enabled = false;   2:  textBox1.ForeColor = Color.Black;
系統還是用它自已的方式來呈現：



這時候我們只能自己繼承TextBox重新寫一個
如下：
   1:  public partial class cTextBox : TextBox   2:  {   3:      public cTextBox()   4:      {   5:          InitializeComponent();   6:      }</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/3778730379695171320/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/textboxenabledfalse.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/3778730379695171320?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/3778730379695171320?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/textboxenabledfalse.html' title='當TextBox.Enabled為false時, 改變字體顏色'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_OxD_FZv7El8/Svj7CsFrzVI/AAAAAAAAAGA/GKCvqL2Cvh8/s72-c/disabletextbox_1.png' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;C0EGSXs7fCp7ImA9WxNUGEk.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-5007720917323384094</id><published>2009-11-10T12:16:00.005+08:00</published><updated>2009-11-10T16:27:08.504+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-10T16:27:08.504+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>隱藏DataGridView裡的Button</title><summary>系統環境：C# 2005

[DataGridViewButtonCell.Visible]的屬性是唯讀的
所以沒辦法在程式中控制這個屬性讓按鈕隱藏
那要怎麼做呢？

有一個很簡單的方法
就是把[DataGridViewButtonCell]改成[DataGridViewTextBoxCell]就可以了

看程式碼：
   1:  private void Form1_Load(object sender, EventArgs e)   2:  {   3:      DataTable dt = new DataTable();   4:      dt.Columns.Add("id");   5:      dt.Columns.Add("item");   6:      for (int i = 0; i &lt; 50; i++)   7:      {   8:</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/5007720917323384094/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/datagridviewbutton.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5007720917323384094?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5007720917323384094?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/datagridviewbutton.html' title='隱藏DataGridView裡的Button'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;D0EGRXs4eSp7ImA9WxNUGE8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-2732771297494097532</id><published>2009-11-05T15:50:00.017+08:00</published><updated>2009-11-10T12:00:24.531+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-10T12:00:24.531+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Software'/><title>Windows Live Sync遠端同步不同電腦間的資料</title><summary>系統環境：Windows 7, Windows Xp

我自己會寫一些小工具
有時候在公司寫一點
下班後就把Code Email給自己
回到家再繼續寫

但說實在這樣真的很不方便
要重複做著壓縮&gt;寄信&gt;收信&gt;解壓縮的動作
有時候一兩個星期沒寫
就忘了哪邊才是最新的版本

Windows Live Sync剛好可以解決我的困擾
以下是個人覺得還不錯的幾個點：
整合MSN帳號
可以同步多台電腦間的資料
資料放在微軟的Live空間
可以加朋友的帳號, 一起同步資料
可以設定同步的權限, 不怕資料外流

下載位置：https://sync.live.com/clientdownload.aspx
(要先登入MSN帳號才能下載)

安裝好後
到[開始功能表]&gt;[所有程式]&gt;[Windows Live]執行[Windows Live Sync]



登入MSN帳號



設定完成



</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/2732771297494097532/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/windows-live-sync.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/2732771297494097532?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/2732771297494097532?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/windows-live-sync.html' title='Windows Live Sync遠端同步不同電腦間的資料'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_OxD_FZv7El8/SvJ8hp_GfQI/AAAAAAAAADU/WYPkBWBPN-k/s72-c/sync_1.png' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;D0cHRXc8fSp7ImA9WxNbFU4.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-6408397975561075418</id><published>2009-11-03T12:59:00.007+08:00</published><updated>2009-11-18T17:03:54.975+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-18T17:03:54.975+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>TextBox點三下全選</title><summary>系統環境：C# 2005

要利用一個[Timer]元件, [Interval]設200
並且在TextBox的[Click]事件中判斷200毫秒內是否連點過兩下滑鼠
如果是就把文字方塊全選

利用一個[DateTime]變數
在[Click]事件中判斷200毫秒內是否連點過兩下滑鼠即可

以下是程式碼
   1:  DateTime doubleClickTimer = DateTime.Now;   2:      3:  private void textBox1_DoubleClick(object sender, EventArgs e)   4:  {   5:      doubleClickTimer = DateTime.Now;   6:  }   7:      8:  private void textBox1_Click(object sender, </summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/6408397975561075418/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/textbox.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/6408397975561075418?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/6408397975561075418?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/textbox.html' title='TextBox點三下全選'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CEcMQ3czfCp7ImA9WxNUEk8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-3635423942773263279</id><published>2009-11-03T12:00:00.001+08:00</published><updated>2009-11-03T12:21:22.984+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-03T12:21:22.984+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title>讓軟體像服務一樣執行</title><summary>系統環境：Windows 7

[執行]&gt;[gpedit.msc]


[電腦設定]&gt;[Windows設定]&gt;[指令碼(啟動/關機)]&gt;[啟動]


[新增]&gt;[瀏覽], 選擇要執行的軟體即可


這樣軟體就可以像服務一樣
不需要登入系統就已經在背景執行了</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/3635423942773263279/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/blog-post.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/3635423942773263279?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/3635423942773263279?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/blog-post.html' title='讓軟體像服務一樣執行'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_OxD_FZv7El8/Su-o9ft64tI/AAAAAAAAADM/6nDnoHMGBFg/s72-c/pgstart_3.png' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;DkABR3k5fCp7ImA9WxNUEk8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-4076509795772863416</id><published>2009-11-02T15:55:00.004+08:00</published><updated>2009-11-03T13:05:56.724+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-03T13:05:56.724+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>用Path類別來處理目錄&amp;檔案名稱</title><summary>系統環境：C# 2005

原來.Net有提供Path類別給我們處理目錄&amp;檔案名稱
不用再傻傻的用字串函數來處理了XD
   1:  using System.IO;   2:      3:  private void Form1_Load(object sender, EventArgs e)   4:  {   5:          string strPath = @"D:\Downloads\test.jpg";   6:             7:          Path.GetFullPath(strPath); //取得完整路徑: "D:\Downloads\test.jpg"   8:             9:          Path.GetPathRoot(strPath); //取得根目錄: "D:\"  10:          </summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/4076509795772863416/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/path.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/4076509795772863416?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/4076509795772863416?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/path.html' title='用Path類別來處理目錄&amp;檔案名稱'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;DE8CR309fCp7ImA9WxNUEU4.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-5279908398154503357</id><published>2009-11-02T10:11:00.003+08:00</published><updated>2009-11-02T12:41:06.364+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-02T12:41:06.364+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title>活動監視器</title><summary>SSMS 2005有個方便好用的活動監視器


SMSS 2008的活動監視器不放在[管理]資料夾裡
而是藏在滑鼠右鍵裡
</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/5279908398154503357/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/11/ssms-2008.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5279908398154503357?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5279908398154503357?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/11/ssms-2008.html' title='活動監視器'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_OxD_FZv7El8/Su4-e7haIxI/AAAAAAAAACU/TtgTX28nfdg/s72-c/SSMS2005.JPG' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CEUNQHg_cCp7ImA9WxNUEk8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-1611335072270379002</id><published>2009-10-31T04:40:00.009+08:00</published><updated>2009-11-03T12:24:51.648+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-03T12:24:51.648+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>禁止程式重複執行</title><summary>系統環境：C# 2005

在[Program.cs]中修改如下
   1:  using System.Threading;   2:      3:  static void Main()   4:  {   5:      bool IsNotExist;   6:      Mutex MyMutex = new Mutex(true, "自訂名稱", out IsNotExist); //判斷程式是否沒有在執行   7:      if (IsNotExist)   8:      {   9:          Application.EnableVisualStyles();  10:          Application.SetCompatibleTextRenderingDefault(false);  11:          Application.Run(</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/1611335072270379002/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/10/blog-post_31.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/1611335072270379002?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/1611335072270379002?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/10/blog-post_31.html' title='禁止程式重複執行'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CEQFQH8-cCp7ImA9WxNUEk8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-8739710633567271393</id><published>2009-10-31T04:19:00.008+08:00</published><updated>2009-11-03T12:25:11.158+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-03T12:25:11.158+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>MaskedTextBox.SelectAll()無作用!?</title><summary>系統環境：C# 2005

當文字方塊取得焦點時
user都會要求文字方塊可以自動全選文字
   1:  private void maskedTextBox1_Enter(object sender, EventArgs e)   2:  {   3:      maskedTextBox1.SelectAll();   4:  }
但遮罩文字方塊在設定遮罩後
上面的事件就沒有用了

解決方法其實也很簡單
只要在該事件中多呼叫一個方法
問題就迎刃而解了
   1:  private void maskedTextBox1_Enter(object sender, EventArgs e)   2:  {   3:      maskedTextBox1.Focus();   4:      maskedTextBox1.SelectAll();   5:  }</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/8739710633567271393/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/10/maskedtextboxselectall.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/8739710633567271393?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/8739710633567271393?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/10/maskedtextboxselectall.html' title='MaskedTextBox.SelectAll()無作用!?'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;CEQHSHc5cCp7ImA9WxNUEk8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-1409703914080834321</id><published>2009-10-31T04:02:00.003+08:00</published><updated>2009-11-03T12:25:39.928+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-11-03T12:25:39.928+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title>使用參數傳遞查詢SQL Server資料速度很慢</title><summary>系統環境：C# 2005, SQL Server 2005

這問題困擾了我非常的久
還以為是C#先天BUG解決不了
今天終於得到解答

這是原本傳遞參數的查詢方法 (資料筆數: 100, 查詢時間: 10分鐘)
   1:  DbCommand p_cmd = DbConnection.CreateCommand();   2:  p_cmd.CommandText = strSQL;   3:  p_cmd.CommandType = CommandType.Text;   4:      5:  DbParameter p_dbParameter = new DbParameter();   6:  p_dbParameter.DbType = DbType.String;   7:  p_dbParameter.ParameterName = "@value";   8:  </summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/1409703914080834321/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/10/sql-server.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/1409703914080834321?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/1409703914080834321?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/10/sql-server.html' title='使用參數傳遞查詢SQL Server資料速度很慢'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;C0EGRns4cCp7ImA9WxNVGU4.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-5290619618463870464</id><published>2009-10-31T03:20:00.003+08:00</published><updated>2009-10-31T03:40:27.538+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-10-31T03:40:27.538+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title>在部落格文章貼上C#/VB/SQL/HTML/XML/ASPX程式碼區塊</title><summary>花了不少時間終於搞定
目前用IE8/Firefox 3.5/Chrome 4瀏覽程式碼區塊都顯示正常
把設定方式記錄一下

先到[版面配置]&gt;[修改HTML]
把以下CSS碼放在&lt;head&gt;標籤中
.code {background: #f0f0f0 url(http://sites.google.com/site/hisamnote/files/code_bg.png) repeat-y scroll left top;display: block;border: 1px solid #CCCCCC;color: #333333;font-family: Courier New;font-size: 10pt;overflow:auto;border: 1px solid #ccc;padding: 10px 10px 10px 21px;max-height:400px;</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/5290619618463870464/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2009/10/cvbsql.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5290619618463870464?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/5290619618463870464?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2009/10/cvbsql.html' title='在部落格文章貼上C#/VB/SQL/HTML/XML/ASPX程式碼區塊'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;AkYGRHw6eip7ImA9WxNVGU8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-1493871904789711768</id><published>2007-12-14T12:02:00.003+08:00</published><updated>2009-10-31T02:42:05.212+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-10-31T02:42:05.212+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='其他分享'/><title>18禁</title><summary>這是朋友的朋友的男朋友
對他女朋友的規定
剛好18條...那就叫18禁吧XD
01. 不要講"對"這個字
02. 不要講話用到你說/他說/我說
03. 講話不要像在講劇本
04. 不要沒有感情
05. 講話不要制式化
06. 不要答非所問
07. 講話簡潔有力, 講重點, 不要講到小細節的事
08. 講話不要極端, 簡潔有力不是要你冷漠
09. 不要拿沒有收訊當理由, 就算真的沒有收訊, 也當作有聽到, 絕對不要自己講收訊不好
10. 回應只要答"嗯"就好, 不要去解釋怕你沒聽到的話, 所有解釋的話, 都不要再講了
11. 這輩子我都不會遷就你
12. 不要讓我這些話講第二次
13. 若有出去玩, 一定要開開心心, 不要悶著不講話, 不要講別人的事, 就只要講我們二個出去玩及目的地的事
14. 我們這輩子, 不會回到以前
15. 你是我最討厭的人
16. 好好去回想我以前所講的話
17.</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/1493871904789711768/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2007/12/18.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/1493871904789711768?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/1493871904789711768?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2007/12/18.html' title='18禁'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;Ak4NRXc_eCp7ImA9WxNVGU8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-9172243871084057703</id><published>2007-12-13T02:31:00.004+08:00</published><updated>2009-10-31T02:56:34.940+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-10-31T02:56:34.940+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='PowerBuilder'/><title>全域函數的覆載</title><summary>我以為只有區域函數才能覆載
原來全域函數也可以
只是需要點技巧
對已存在的全域函數使用[Edit Source]編輯
再把要覆載的方法加進去就可以了
   1:  return type f_msg from function_object   2:  end type   3:      4:  forward prototypes   5:      return int f_msg ( string as_msg ) //原本的函數   6:      return int f_msg ( string as_title, string as_msg )  //覆載的函數   7:  end prototypes   8:      9:  return int f_msg ( string as_msg ); //原本的函數  10:      messagebox ( "", </summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/9172243871084057703/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2007/12/blog-post_8666.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/9172243871084057703?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/9172243871084057703?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2007/12/blog-post_8666.html' title='全域函數的覆載'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry gd:etag='W/&quot;A0MER348fSp7ImA9WxNVGU8.&quot;'><id>tag:blogger.com,1999:blog-6485751827474227261.post-2728725744841452403</id><published>2007-12-12T17:32:00.003+08:00</published><updated>2009-10-31T03:03:26.075+08:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2009-10-31T03:03:26.075+08:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='PowerBuilder'/><title>法雅客的PB試題</title><summary>之前去應徵的時候考的題目
不過真的很少人在用PB了
連我都快忘了要怎麼用XD

試題如下:
1. 請寫出dw_1連結SQLCA的語法?
2. dw_1重新retrieve資料時, 如何保留前一次的資料?
3. 如何判斷dw_1更新成功或失敗?
4. 兩視窗w_1和w_2, w_1要如何傳遞參數開啟w_2? w_2要如何接受w_1傳來的參數?</summary><link rel='replies' type='application/atom+xml' href='http://hisamnote.blogspot.com/feeds/2728725744841452403/comments/default' title='張貼意見'/><link rel='replies' type='text/html' href='http://hisamnote.blogspot.com/2007/12/x.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/2728725744841452403?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6485751827474227261/posts/default/2728725744841452403?v=2'/><link rel='alternate' type='text/html' href='http://hisamnote.blogspot.com/2007/12/x.html' title='法雅客的PB試題'/><author><name>Sam</name><uri>http://www.blogger.com/profile/07179532827147594623</uri><email>shenghdc@gmail.com</email><gd:extendedProperty name='OpenSocialUserId' value='01592400317501097051'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>