Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

Text Box Question

can anybody tell me how to format that value while typing (change event) into the textbox?

1,234,456,657.98

thanks
0
blacklord
Asked:
blacklord
1 Solution
 
Mikal613Commented:
you may want to use the MaskedEdit Control
0
 
blacklordAuthor Commented:
I cant because the number lenght is not always the same. I think that I should use textbox.
0
 
Mikal613Commented:
it doesnt make a differnce the Mask takes care of that
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
blacklordAuthor Commented:
Ok but How can I format that field while it is typeing? I mean on change event? Because  Maskedbox formats the value on lost foucs event. And If I use mask control I have to give the maximum digit, because user might enter milliions or cents.
0
 
Mikal613Commented:
well you write ###,###,###.00

as the mask and it will format it as you write it.
0
 
Mikal613Commented:
Standard cant talk to the satellite  
0
 
blacklordAuthor Commented:
ok but how can you enter that value into that field? 1,233.66
by typing 000,001,233.66 ?
0
 
Mikal613Commented:
# means that its blank if its not there
0 means that it fills it with a 0 if not used
0
 
blacklordAuthor Commented:
I'm able to enter this value which is the last thing that I want in my db :)
34_,___,_45.00
0
 
Mikal613Commented:
thats not a value

 000,001,233.66  = 1,233.66  is a value
0
 
bramsquadCommented:
   Private Sub txtNum_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtNum.TextChanged
        Try
            txtNum.Text = CLng(txtNum.Text).ToString("N0")
            txtNum.SelectionStart = txtNum.TextLength
        Catch ex As Exception
        End Try
    End Sub

~b
0
 
blacklordAuthor Commented:
thanks for answer bramsquad but I am using vb6.0
0
 
gecko_au2003Commented:
if you go to the change event of the text box, type :

format(textbox1.text, ###,###,###.00)

basically you tell it to use the format function and in the parentsis you put the value you want formatting which in your case is what ever is entered into the textbox so I put textbox1.text and then after the comma you put the format you want the value obviously.

or something like that,  here is a pdf file that should help you out :

http://webspace.dialnet.com/paul_pbcoms/vb/vb6.pdf

I hope this helps, kind regards

shane

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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