[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

assigning 0 to a textbox problem

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
themroc
Asked:
themroc
1 Solution
 
zULuCommented:
if var_textbox=0 then
    txt_textbox = 0
else
    txt_textbox = Format(var_textbox, "####.#")
end if
that should do it
0
 
hamoodCommented:
Use this one
txt_textbox = FormatNumber(var_textbox, 1)

it will disply value like 0.0
0
 
mmusanteCommented:
Try this ...

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

if you want '0.' or this

Format(var_textbox, "###0.0")

if you want '0.0'
0
 
ShauliCommented:
txt_textbox = IIF(var_textbox = 0, 0, FormatNumber(var_textbox, 1))

S
0
 
themrocAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now