Solved

Text Box Question

Posted on 2004-10-20
14
171 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using YubiKey with REST API application 2 106
count8 challlenge 13 116
How  do I get an older program to run in Windows 10? 20 102
oracle query help 18 99
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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…

947 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