Solved

assigning 0 to a textbox problem

Posted on 2004-08-11
5
290 Views
Last Modified: 2010-05-02
I fill in a text box 9txt_textbox) with a variable (var_textbox)
using this function.

txt_textbox = Format(var_textbox, "####.#")

The variable var_textbox is declared as single.

Now my problem. If the variable is set to zero , than on the screen it comes up with an entry like

  .     That means a single dot is visible in the textbox.
How do I have to programme to show actuakky the 0 value?  Or I would not mind neither an empty textbox with no dot at all instead
0
Comment
Question by:themroc
5 Comments
 
LVL 2

Expert Comment

by:zULu
ID: 11770956
if var_textbox=0 then
    txt_textbox = 0
else
    txt_textbox = Format(var_textbox, "####.#")
end if
that should do it
0
 
LVL 4

Accepted Solution

by:
hamood earned 100 total points
ID: 11771003
Use this one
txt_textbox = FormatNumber(var_textbox, 1)

it will disply value like 0.0
0
 
LVL 6

Expert Comment

by:mmusante
ID: 11771064
Try this ...

Format(var_textbox, "###0.#")

if you want '0.' or this

Format(var_textbox, "###0.0")

if you want '0.0'
0
 
LVL 19

Expert Comment

by:Shauli
ID: 11771446
txt_textbox = IIF(var_textbox = 0, 0, FormatNumber(var_textbox, 1))

S
0
 

Author Comment

by:themroc
ID: 11771485
I think hammod gave the most appropriate answer, this really solve the problem and because it is tied in a way to the country setting in fact it solves other issued I HAD TOO!
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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

867 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