• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

textboxes formar

i would like to have like a mask in the textbox, how can i do???

i have this number in the textbox 45678.90, i would like this format 45,678.90 when the lostfocus of the textbox.
0
losoeos
Asked:
losoeos
  • 2
1 Solution
 
Fernando SotoCommented:
Hi losoeos;

This code will do it for you.

    Private Sub TextBox1_LostFocus(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles TextBox1.LostFocus

        Dim valueStr As String = TextBox1.Text
        Dim value As Double

        If Not IsNumeric(valueStr) Then
            MessageBox.Show("Text box value is in the wrong format")
        Else
            value = Double.Parse(valueStr)
            TextBox1.Text = value.ToString("N")
        End If


    End Sub


Fernando
0
 
anwar ul haqueCommented:
Hi
User this control AMS.TextBox.dll instead, and it will give you propery DigitsInGroup set its value to 3. You can find more information from here
http://www.codeproject.com/cs/miscctrl/ValidatingTextBoxControls.asp.
Hope this will help
Regards
Anwar ul Haque
0
 
Fernando SotoCommented:
Hi Bob;

I would like to see a resolution to this question as I posted a working solution.

Thanks;

Fernando
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now