Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How Can i do This in VB?

How Can i do This in VB?

Scheduled Pinned Locked Moved Visual Basic
questionhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aloksingh2006
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • A aloksingh2006

      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

      J Offline
      J Offline
      Janani Divya
      wrote on last edited by
      #2

      Ya u can do this by using regular expression regex. Janani

      A 1 Reply Last reply
      0
      • J Janani Divya

        Ya u can do this by using regular expression regex. Janani

        A Offline
        A Offline
        aloksingh2006
        wrote on last edited by
        #3

        regex What is that? Kindly tell me i will be very thankful to you. with regards

        Withe Regards Alok Singh

        J 1 Reply Last reply
        0
        • A aloksingh2006

          regex What is that? Kindly tell me i will be very thankful to you. with regards

          Withe Regards Alok Singh

          J Offline
          J Offline
          Janani Divya
          wrote on last edited by
          #4

          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

          A 1 Reply Last reply
          0
          • J Janani Divya

            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

            A Offline
            A Offline
            aloksingh2006
            wrote on last edited by
            #5

            Thank you very much Janani Divya

            Withe Regards Alok Singh

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups