Solved

Text Box Question

Posted on 2004-10-20
14
172 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C Programming - If Statement 8 78
C# code editing and collaboration 3 117
VbScript to countdown to New Year's Day 6 55
"Black Box" Testing of Control System Software 2 53
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 problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

831 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