Code Snippet(3)> clear ค่า 20 textbox ภายในคลิกเดี๋ยว
ทำการวนลูปภายใน form, แล้วตรวจสอบว่าเป็น textbox หรือเปล่า
foreach (Control tx in this.Controls)
{
if (tx.GetType() == typeof(System.Windows.Forms.TextBox))
{
tx.Text = "";
}
}
Code Snippet(2)>หาความแตกต่างระหว่างวันที่
ใช้ TimeSpan ช่วยในการเก็บตัวเลข เพื่อใช้ในการแสดงในรูปแบบแตกต่างกันไป
DateTime d1 = new DateTime( 2000, 7, 13 );DateTime d2 = new DateTime( 2003, 12, 5 ); TimeSpan s = d2 - d1; int numberofdays = s.TotalDays
References
For more information on the DateTime structure visit MSDN at microsoft here
For more information on the TimeSpan structure visit MSDN at microsoft here
MSDN Shortcut(1): String.Split Method

Example
string s1 = “one,two,three”;
//สร้างเครื่องหมายที่ใช้ตัด
char[] charSeparators = new char[] {‘,’};
string[] resulte = s1.Split(charSeparators, StringSplitOptions.None);
Console.WriteLine(“{0}”,resulte[resulte.Length - 1]);
Output
three
URL
ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.NETDEVFX.v20.en
/cpref2/html/O_T_System_String_Split.htm
How connect to database from javascript
ลักษณะการ connect จะเป็นแบบ client conncet มากกกว่า ภายในเครื่อง local เอง ในที่นี้จะเป็น Access
< html >
< SCRIPT LANGUAGE=javascript >
< !--
function ConDB()
{
var conn = new ActiveXObject("ADODB.Connection") ;
var connectionstring="Provider=SQLOLEDB;Password=;User ID=;Initial Catalog=;Data Source=;"
conn.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("SELECT * FROM YourTablename ", conn);
rs.MoveFirst
while(!rs.eof)
{
document.write( yourtablefieldname);
rs.movenext;
}
rs.close;
conn.close;
} //–>
< /SCRIPT >
< body OnLoad=”javascript:ConDB()” >< /body >
< /html >
การเขียน IIF (เรียกว่า short -circuit)
เป็นของ VB โดยระบุเงื่อนไข หากเป็นจริงให้ทำตามคำสั่งแรก ถ้าไม่จริงให้ทำตามคำสั่งหลัง
ถ้าของ C# เขียนแบบนี้ (Condition) ? when True : when false ;
VB : x = IIF(x>0,1,0)
C# : x = (x > 0) ? 1 : 0;