Technology, Art, Solution, Tips, Multimedia, How To, What Is, Programming, Software, Freelance
Feb 21, 2008
Validate Input Values With Message List
Dim messageList As ArrayList = New ArrayList()
DataFormat.SetDateSeparator("/")
If (pageType <> PageType.Search) Then ' Add/Edit Validation
Dim fullName As TextBox = TryCast(control.FindControl("fullName"), TextBox)
If (fullName IsNot Nothing) Then
If (Not DataFormat.CheckString(fullName.Text)) Then
messageList.Add("Invalid Value (String): fullName")
End If
End If
Dim phoneNumber As TextBox = TryCast(control.FindControl("phoneNumber"), TextBox)
If (phoneNumber IsNot Nothing) Then
If (Not DataFormat.CheckInt32(phoneNumber.Text)) Then
messageList.Add("Invalid Value (Int32): Phone Number")
End If
End If
End If
Return IIf(messageList.Count = 0, Nothing, messageList)
End Function
' Powerful TIPs !
Dim source As WebControl = TryCast(sender, WebControl)
Page Load Function Tips
Protected Sub Page_Load(ByVal s As Object, ByVal e As System.EventArgs)
' Registering external javascript file, so that we can have more neater js file management.
Page.ClientScript.RegisterClientScriptInclude("ethan", "ethan.js")
' Cache Setting, I just know about
' ASP Caching can be set manually on the virtual directory property
Response.Cache.SetCacheability(HttpCacheability.NoCache)
' Auto-find control and set focus to it;
' I just know got such a syntax, which really near to human language syntax "IsNot"
' and about ClientID property which is very useful in some case.
If (tblpwdDetailsView.FindControl("fullName") IsNot Nothing) Then
Page.Form.DefaultFocus = tblpwdDetailsView.FindControl("fullName").ClientID
End If
' The way they check for QueryString exist or not
If (Not Page.IsPostBack) Then
If (Request.QueryString.Count > 0) Then
......
Feb 20, 2008
MMC cannot open the file C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC.

Case:
When you click on "SQL Server Enterprise Manager" shortcut,
you get "MMC cannot open the file C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC.
This may be because the file does not exist, is not an MMC console, or was created by a later version of MMC. This may also be because you do not have sufficient access rights to the file."
First I try to check the NTFS Security Permission and is already set to administrator.
Probably the file had corrupted.
Suggested solution:
- Select Start - Run.
- At the Open prompt enter: mmc
- Click OK
- Select File - Add/Remove Snap-in...
- Click Add...
- Select Microsoft SQL Enterprise Manager
- Click Add, then Close
- Click Ok to return to the mmc.
- Select File - Save As...
- Delete or rename the original (offending) file out the way.
- Save the new msc file as C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC
Now your original shortcut should work.
Alternatively you can always access Enterprise Manager from within the Computer Management mmc.
Reference From: http://geekswithblogs.net/timh/archive/2005/08/09/49716.aspxThanks to Tim Huffam (geekswithblogs) and Sin Huei ( my college)
Converting Valid XML String To Dataset
Imports System.Xml
Imports System.Data
Imports System.IO
Dim sb As New System.Text.StringBuilder
sb.Append("
sb.Append("
sb.Append("
sb.Append("
sb.Append("
sb.Append("
' Covert to string reader then to xmltextreader
Dim reader As New XmlTextReader(New StringReader(sb.ToString))
Dim ds As New DataSet
ds.ReadXml(reader)
' Return dataset
Return ds
1. First you need to use StringReader to read the string.
2. Convert it to XmlTextReader
3. Create a new dataset to
Feb 19, 2008
Windows Experice Index and Vista Rating

My machine vista rating. so far so good ?
What is the Windows Experience Index?
The Windows Experience Index measures the capability of your computer's hardware and software configuration and expresses this measurement as a number called a base score. A higher base score generally means that your computer will perform better and faster than a computer with a lower base score, especially when performing more advanced and resource-intensive tasks.
Each hardware component receives an individual subscore. Your computer's base score is determined by the lowest subscore. For example, if the lowest subscore of an individual hardware component is 2.6, then the base score is 2.6. The base score is not an average of the combined subscores.
You can use the base score to confidently buy programs and other software that are matched to your computer's base score. For example, if your computer has a base score of 3.3, then you can confidently purchase any software designed for this version of Windows that requires a computer with a base score of 3 or lower.
Recommend Reading:
Accessing Web.Config AppSettings Collection Value
** replace ( to < ** replace ) to >
(appSettings)
(add key="ContentFrameHeight" value ="600px"/)
(add key="ContentFrameWidth" value="700px"/)
(add key="MenuFrameHeight" value="400px"/)
(add key="MenuFrameWidth" value="250px" /)
(/appSettings)
Usually AppSettings placement:
configuration
configSections
"AppSettings"
system.web
Before using System.Configuration.Manager
We might need to add .NET reference, because by default this reference might not be added.
1. Right click "Add reference" > Add the System.Configuration as below figure.

Then you can apply the syntax below:

E.g syntax:
Dim height As String = ConfigurationManager.AppSettings("ContentFrameHeight").ToString



