-
Formatting issue
Hey all - sorry if this has been answered somewhere before - but I'm having a heck of a time finding right answer.
I'm using VB 2008 and reading data from an access 2003 database.
I have a query setup in access - read in as a 'view' in vb ... that is showing results of first pass yield. total good parts... total bad parts... and percentage of yield. in my access query - i have the percentage displaying properly using the column format in access... however - on my form -
the data source comes in as a textbox...by default.
I can't seem to google the right question - but right now on my form, even though the dataset recognizes it as a double precision number - the option in the datasource tab - shows it as a text box or data grid right ...
so on my form i have the text box or details option... but my text box shows the percentage as a long decimal ... .98936524 or whatever...
what's the correct string i need to format the textbox.text to display a percentage?
I tried format(val(textbox.text), 0.00) that didn't do anything...
and I did this under the form load section after the data sets were filled.
thanks for any suggestions... I'm at a loss.
-
Re: Formatting issue
-
Re: Formatting issue
Thanks, but I'm not sure I follow.
I've added the "details" of my dataset to the form....
this generated textboxes for each column of my 'view' or qccess query.
The query comes back with 4 columns, and only one row of information.
each text box then, only has one value. the textbox.text ...
I need to format textbox.text to show % ... not a double precision decimal of about 6 places... and that's where I'm stuck. do I need to convert or take the val(texbox.text) - then format that? do i need to read the textbox value - format and assign to a label instead? I looked at the masked textbox 0 but it doesn't seem that I can databind it.
-
Re: Formatting issue
Code:
Dim d As Double = 0.98936524D
MsgBox(Format(d, "#0.0%"))
-
Re: Formatting issue
Ok - I understand that as far as being a variable input ...
but this is for output purposes.
I'm not assigning a value - the value is already assigned to textbox.text
I just need to display it correctly.
make sense?
the form loads and populates the textbox.text property...
-
Re: Formatting issue
variable or expression - there's no difference
You assigned this expression to the TextBox somehow? All you have to do is to assign a formatted expression instead.