Text box formating in vb 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • godhulirbalaka
    New Member
    • Oct 2007
    • 26

    Text box formating in vb 6.0

    Hai, I wana to format a text box.

    TextBox Name is txt_amount

    So i want when the program in run mode then the text box has automaticly 0.00 will appear and when i worte any number then first 0 will delete and there will be my pressed number and when i press . point (.) then cursor will automaticly come after point and new neurmaric value will after the point.

    i. e . 25.36
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    Use [CODE=vb]SendKeys "{End}"[/CODE]

    Comment

    • godhulirbalaka
      New Member
      • Oct 2007
      • 26

      #3
      Originally posted by CyberSoftHari
      Use [CODE=vb]SendKeys "{End}"[/CODE]

      Hi would you please clear more

      Comment

      • Mohan Krishna
        New Member
        • Oct 2007
        • 115

        #4
        Hi godhulirbalaka!

        May this help you...

        ALL THE BEST!
        Respond if it helps u
        Attached Files

        Comment

        • CyberSoftHari
          Recognized Expert Contributor
          • Sep 2007
          • 488

          #5
          Good work Mohan Krishna. Let him try, Donot post Detail source code.

          @godhulirbalaka : You can use mask textbox which is already formated as you require.
          Last edited by CyberSoftHari; Dec 3 '07, 03:40 AM. Reason: @godhulirbalaka :

          Comment

          • 9815402440
            New Member
            • Oct 2007
            • 180

            #6
            hi

            if the length of the number to be input is fixed or known then use MaskEDBox instead. set its Mask Property to "99.99" this will display __.__ as input mask at run time. if the length of the text is not known you can try the method suggested by mohan krishna. or can use following code in the lost_focus event of the text box.


            private sub text1_lostFocus ()
            text1.text = format(text1.te xt,"#0.00")
            end sub

            regards
            manpreet singh dhillon

            Comment

            Working...