• Hi Guest: Welcome to TRIBE, the online home of TRIBE MAGAZINE. If you'd like to post here, or reply to existing posts on TRIBE, you first have to register. Join us!

vb .net

dj Red Turtle

TRIBE Promoter
How do I assign a double or decimal a 2 precision point number, i.e 1.50 or 0.00 ? Visual Studio seems to cut off the extra 0 but I need it to display a 2 decimal point number in a label.
Alex D. from TRIBE on Utility Room


TRIBE Promoter
Hrmm.. I dunno about vb but in c# you would use String.format for display...

string doubleForLabel = string.Format(@"{0:D2}", originalDouble);

This will always pad to two decimals for you... I think the syntax is the same or similar for vb...

Replace the smiley with colon D


TRIBE Member
Ew, it's a full-on function? Messy. Please don't tell me you had to code it yourself, and it was instead part of a class library.

I was thinking that the Double/Decimal data type would definitely have an inborn property or method to handle it. Although I'm sure if it was that easy, the question wouldn't be in here.

What's the function, for my curiosity's sake?

*sigh* I need to reinstall vs.net - I miss pretending to be smrt.
tribe cannabis accessories silver grinders

dj Red Turtle

TRIBE Promoter
Nevermind just figured it out. Wow this is the first time I could acutally code stoned. Better test it tomorrow to make sure :p