Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Text Box Question

Posted on 2004-10-20
14
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 375 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
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…
Introduction to Processes

722 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