Solved

Text Box Question

Posted on 2004-10-20
14
170 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
 

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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countPairs challenge 7 58
Path of Workbook 3 45
Eclipse Neon start with Admin account only 6 50
Java Loop 4 14
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A short article about problems I had with the new location API and permissions in Marshmallow
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now