目前分類:C#-Window Form (73)

瀏覽方式: 標題列表 簡短摘要

用迴圈來印出英文字母A到Z的話

就不用用Swith在那邊Case 26次

雖然應該沒人會這樣Switch啦... 

welkingunther 發表在 痞客邦 留言(1) 人氣()

WinForm用程式加入某個信任的網站和更改IE瀏覽器的設定

三個參考的網站

http://support.microsoft.com/kb/182569/

welkingunther 發表在 痞客邦 留言(0) 人氣()

一般都是直接用某個Connection去建立連接
像是SqlConnection或是OleDbConnection..等等
但另外有個通用法,只要改Provider就可改連接的方法

welkingunther 發表在 痞客邦 留言(0) 人氣()

//把目前選到的值存起來
String CurrentCellValue;
CurrentCellValue = myDataGridView.CurrentCell.Value.ToString();

welkingunther 發表在 痞客邦 留言(0) 人氣()

XmlReader myReader;
myReader = XmlReader.Create(XmlStream);

welkingunther 發表在 痞客邦 留言(0) 人氣()


DataTable也可以接事件阿

RowState有好幾種狀態

welkingunther 發表在 痞客邦 留言(0) 人氣()

一直沒發現,每次做Fill時就停在那

原來有事件可以監測一筆一筆的Row阿=.=

另外要用CommandBuilder的話Select敘述裡面的欄位要包含PrimaryKey或是UniqueKey

welkingunther 發表在 痞客邦 留言(0) 人氣()

DataColumn的Expression用法
//========================
DataColumn TotalPriceColumn = new DataColumn

welkingunther 發表在 痞客邦 留言(0) 人氣()

 

//讓從資料庫抓回來的資料以XML的格式表現

SqlCommand myXMLCommand = new SqlCommand();

welkingunther 發表在 痞客邦 留言(0) 人氣()

//下面這欄就是CheckBox

dt.Columns.Add("IsSelected", System.Type.GetType("System.Boolean"));

dt.Columns.Add("Type");

welkingunther 發表在 痞客邦 留言(1) 人氣()

通常看到以下這種XML具有xmlns的NameSpace設定時,常常用

SelectNodes或SelectSingleNode都會選到奇怪的Node,或是選不到

welkingunther 發表在 痞客邦 留言(1) 人氣()

有時不想用Timer,就用以下方法去減

//先在Class的全域變數的地方宣告開始的時間

long StartDate = DateTime.Now.Ticks;

welkingunther 發表在 痞客邦 留言(0) 人氣()

在UserControl裡的程式寫

  public delegate void myDelegate(string welkin);

  public event myDelegate welkinEvent;

welkingunther 發表在 痞客邦 留言(0) 人氣()

把this傳進去就好

DialogForm myDialog = new DialogForm();
DialogResult myResult;

welkingunther 發表在 痞客邦 留言(0) 人氣()

就是自訂一個控制項時,在左邊工具列上的小圖案


[ToolboxBitmap(@"C:\myBitmap.bmp")]

welkingunther 發表在 痞客邦 留言(0) 人氣()

 宣告
public delegate string myDelegate(int myNumber);

//要被呼叫的函式

welkingunther 發表在 痞客邦 留言(0) 人氣()

System.Media.SoundPlayer myPlayer = new
System.Media.SoundPlayer(@"C:\Music\welkin.wav");

myPlayer.Play();

welkingunther 發表在 痞客邦 留言(0) 人氣()

IDataObject data = Clipboard.GetDataObject();

if (data.GetDataPresent(DataFormats.Text))
{

welkingunther 發表在 痞客邦 留言(0) 人氣()

宣告
private SqlConnection ConnectionToSql =
 new SqlConnection("Data Source=.\\sqlexpress;

welkingunther 發表在 痞客邦 留言(0) 人氣()

在想要拖拉(Drag-and-Drop)的控制項上textBox1

的MouseDown的事件寫

textBox1.DoDragDrop(textBox1.Text,DragDropEffects.Copy|DragDropEffects.Move);

welkingunther 發表在 痞客邦 留言(0) 人氣()

1 234