How Can i do This in VB?
-
Hi I want coding for a text box in which if i press a '.' Dot from keyboard then a message should be displayed and that '.' Dot must not be seen in that TextBox. How can i do that. Please help me. I have coding for text box in which if i press more then 1 '.' dot then message will be seen But how can i do for first '.'dot? If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 46 Then If KeyAscii = 46 Then If InStr(TxtMRP.Text, ".") Then KeyAscii = 0 MsgBox "You can enter One Decimal at a Time", vbInformation Exit Sub End If End If End If
Withe Regards Alok Singh
-
Hi I want coding for a text box in which if i press a '.' Dot from keyboard then a message should be displayed and that '.' Dot must not be seen in that TextBox. How can i do that. Please help me. I have coding for text box in which if i press more then 1 '.' dot then message will be seen But how can i do for first '.'dot? If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 46 Then If KeyAscii = 46 Then If InStr(TxtMRP.Text, ".") Then KeyAscii = 0 MsgBox "You can enter One Decimal at a Time", vbInformation Exit Sub End If End If End If
Withe Regards Alok Singh
Ya u can do this by using regular expression regex. Janani
-
Ya u can do this by using regular expression regex. Janani
regex What is that? Kindly tell me i will be very thankful to you. with regards
Withe Regards Alok Singh
-
regex What is that? Kindly tell me i will be very thankful to you. with regards
Withe Regards Alok Singh
Dim Id As Boolean = ValidateSearch(TextBox1.Text) If Id = True Then --------> U do ur functionality. else MsgBox("Don't Enter Dots", MsgBoxStyle.OkOnly) end if This is the regular expression. U include it in ur code behind. Public Function ValidateSearch(ByVal texttype As String) As Boolean Dim RoomType As System.Text.RegularExpressions.Regex _ = New System.Text.RegularExpressions.Regex("[0-9]+$") Dim M As System.Text.RegularExpressions.Match = RoomType.Match(texttype) Return M.Success End Function This regular expression will accept only numbers. Like this there are several expressions, like characters etc. -- modified at 2:05 Monday 30th October, 2006 With regards Janani
-
Dim Id As Boolean = ValidateSearch(TextBox1.Text) If Id = True Then --------> U do ur functionality. else MsgBox("Don't Enter Dots", MsgBoxStyle.OkOnly) end if This is the regular expression. U include it in ur code behind. Public Function ValidateSearch(ByVal texttype As String) As Boolean Dim RoomType As System.Text.RegularExpressions.Regex _ = New System.Text.RegularExpressions.Regex("[0-9]+$") Dim M As System.Text.RegularExpressions.Match = RoomType.Match(texttype) Return M.Success End Function This regular expression will accept only numbers. Like this there are several expressions, like characters etc. -- modified at 2:05 Monday 30th October, 2006 With regards Janani
Thank you very much Janani Divya
Withe Regards Alok Singh