Public Function Fn_Check_Characters(ByVal T As TextBox) As Boolean
Dim Str, j As String
Dim i As Integer
Str = T.Text
Fn_Check_Characters = True
For i = 1 To Len(Str)
j = Mid(Str, i, 1)
If Not ((Asc(j) >= 65 And Asc(j) <= 90) Or (Asc(j) >= 97 And Asc(j) <= 122) Or (Asc(j) = 32) Or (Asc(j) = 46)) Then
Fn_Check_Characters = False
Exit For
End If
Next
End Function
Public Function Fn_Check_DataGrid_String(ByVal NewStr As String) As Boolean
Dim Str, j As String
Dim i As Integer
Fn_Check_DataGrid_String = True
For i = 1 To Len(NewStr)
j = Mid(NewStr, i, 1)
If Not ((Asc(j) >= 65 And Asc(j) <= 90) Or (Asc(j) >= 97 And Asc(j) <= 122) Or (Asc(j) = 32) Or (Asc(j) = 46)) Then
Fn_Check_DataGrid_String = False
Exit For
End If
Next
End Function
Public Function Fn_Check_Extra_Characters(ByVal T As TextBox) As Boolean
Dim Str, j As String
Dim i As Integer
Str = T.Text
Fn_Check_Extra_Characters = True
For i = 1 To Len(Str)
j = Mid(Str, i, 1)
If Not ((Asc(j) >= 65 And Asc(j) <= 90) Or (Asc(j) >= 97 And Asc(j) <= 122) Or (Asc(j) = 32) Or (Asc(j) = 46) Or (Asc(j) = 44) Or (Asc(j) = 47) Or (Asc(j) = 40) Or (Asc(j) = 41) Or (Asc(j) = 59)) Then
Fn_Check_Extra_Characters = False
Exit For
End If
Next
End Function
Public Function Fn_Check_Pure_Numbers(ByVal T As TextBox) As Boolean
Dim Str, j As String
Dim i As Integer
Str = T.Text
Fn_Check_Pure_Numbers = True
For i = 1 To Len(Str)
j = Mid(Str, i, 1)
If Not ((Asc(j) >= 48 And Asc(j) <= 57)) Then
Fn_Check_Pure_Numbers = False
Exit For
End If
Next
End Function
Public Function Fn_Check_Pure_Numbers1(ByVal T As String) As Boolean
Dim Str, j As String
Dim i As Integer
Str = T
Fn_Check_Pure_Numbers1 = True
For i = 1 To Len(Str)
j = Mid(Str, i, 1)
If Not ((Asc(j) >= 48 And Asc(j) <= 57)) Then
Fn_Check_Pure_Numbers1 = False
Exit For
End If
Next
End Function
Public Function Fn_Check_DataGrid_Numbers(ByVal NewStr As String) As Boolean
Dim j As String
Dim i As Integer
Fn_Check_DataGrid_Numbers = True
For i = 1 To Len(NewStr)
j = Mid(NewStr, i, 1)
If Not ((Asc(j) >= 48 And Asc(j) <= 57)) Then
Fn_Check_DataGrid_Numbers = False
Exit For
End If
Next
End Function
Public Function Fn_Check_Numbers(ByVal T As TextBox) As Boolean
Dim Str, j As String
Dim i, Cnt As Integer
Cnt = 0
Str = Trim(T.Text)
Fn_Check_Numbers = True
For i = 1 To Len(Str)
j = Mid(Str, i, 1)
If j = "." Then
Cnt = Cnt + 1
If Cnt = 2 Then
Fn_Check_Numbers = False
Exit For
End If
End If
If Not ((Asc(j) >= 48 And Asc(j) <= 57) Or Asc(j) = 46 Or Asc(j) = 45) Then
Fn_Check_Numbers = False
Exit For
End If
Next
End Function
Public Function Fn_Check_Alpha_Numeric(ByVal T As TextBox) As Boolean
Dim Str, j As String
Dim i As Integer
Str = T.Text
Fn_Check_Alpha_Numeric = True
For i = 1 To Len(Str)
j = Mid(Str, i, 1)
If Not ((Asc(j) >= 65 And Asc(j) <= 90) Or (Asc(j) >= 97 And Asc(j) <= 122) Or (Asc(j) = 32) Or (Asc(j) >= 48 And Asc(j) <= 57) Or (Asc(j) = 46)) Then
Fn_Check_Alpha_Numeric = False
Exit For
End If
Next
End Function
Public Function Fn_Date_Validations(ByVal EDay As DropDownList, ByVal Emonth As DropDownList, ByVal EYear As DropDownList) As Boolean
Dim Str As String
Fn_Date_Validations = True
If Emonth.SelectedItem.Text = "Feb" Then
If (Val(EYear.SelectedItem.Text) Mod 4) = 0 Then
If Val(EDay.SelectedItem.Text) > 29 Then
Fn_Date_Validations = False
Exit Function
End If
Else
If Val(EDay.SelectedItem.Text) > 28 Then
Fn_Date_Validations = False
Exit Function
End If
End If
Else
Str = Emonth.SelectedItem.Text
If Not (Str = "Jan" Or Str = "Mar" Or Str = "May" Or Str = "Jul" Or Str = "Aug" Or Str = "Oct" Or Str = "Dec") Then
If Val(EDay.SelectedItem.Text) > 30 Then
Fn_Date_Validations = False
Exit Function
End If
End If
End If
End Function
Public Sub Pr_Month_Numeric_Validations(ByVal EDay As DropDownList, ByVal Emonth As DropDownList, ByVal EYear As DropDownList)
Dim Str As String
If EYear.SelectedItem.Text = "Year" Or Emonth.SelectedItem.Text = "Month" Then
Exit Sub
End If
If Emonth.SelectedItem.Text = "2" Then
If (EYear.SelectedItem.Text Mod 4) = 0 Then
Call Pr_Fill_Combo_Days(EDay, 29)
Else
Call Pr_Fill_Combo_Days(EDay, 28)
End If
Else
Str = Emonth.SelectedItem.Text
If Str = "1" Or Str = "3" Or Str = "5" Or Str = "7" Or Str = "8" Or Str = "10" Or Str = "12" Then
Call Pr_Fill_Combo_Days(EDay, 31)
Else
Call Pr_Fill_Combo_Days(EDay, 30)
End If
End If
End Sub
Public Function removesplcharacter(ByVal ValArray() As Char) As String
Dim usability As String = ""
For i As Integer = 0 To ValArray.Length - 1
If Not ValArray(i) = " " And Not ValArray(i) = "-" And Not ValArray(i) = "." Then
usability = usability + ValArray(i)
End If
Next
Return usability
End Function
Monday, October 26, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment