Solved

Text Box Question

Posted on 2004-10-20
14
174 Views
Last Modified: 2010-04-17
can anybody tell me how to format that value while typing (change event) into the textbox?

1,234,456,657.98

thanks
0
Comment
Question by:blacklord
14 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 12362848
you may want to use the MaskedEdit Control
0
 

Author Comment

by:blacklord
ID: 12362919
I cant because the number lenght is not always the same. I think that I should use textbox.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12363034
it doesnt make a differnce the Mask takes care of that
0
Independent Software Vendors: 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!

 

Author Comment

by:blacklord
ID: 12363142
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
 
LVL 48

Expert Comment

by:Mikal613
ID: 12363178
well you write ###,###,###.00

as the mask and it will format it as you write it.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12363205
Standard cant talk to the satellite  
0
 

Author Comment

by:blacklord
ID: 12363227
ok but how can you enter that value into that field? 1,233.66
by typing 000,001,233.66 ?
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12363346
# means that its blank if its not there
0 means that it fills it with a 0 if not used
0
 

Author Comment

by:blacklord
ID: 12363470
I'm able to enter this value which is the last thing that I want in my db :)
34_,___,_45.00
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12363552
thats not a value

 000,001,233.66  = 1,233.66  is a value
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 12363553
   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
 

Author Comment

by:blacklord
ID: 12373188
thanks for answer bramsquad but I am using vb6.0
0
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 125 total points
ID: 12374821
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question