Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i want that the string (number) which the user inputs gonna convert to a currency format , anyone knows how i should do it?

for e.g:

 

dim str as string = ""

 

str=textbox1.text

 

str=str.tostring("C")

 

doest work :(

 

lets say the user input is 12000 i want to convert it to 12,000

anyway to do it?

  • Leaders
Posted
i never knew what the .Parse function is for?

A question?

 

The .Parse just converts it into a numerical value.

So, it goes from the text "120000" to the actual number 120000, using Parse.

Much like the Convert.ToDecimal() function.

Then, the actual number is converted back to string with currency settings.

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted
A question?

 

The .Parse just converts it into a numerical value.

So, it goes from the text "120000" to the actual number 120000, using Parse.

Much like the Convert.ToDecimal() function.

Then, the actual number is converted back to string with currency settings.

 

so i can use the convert.todecimal or Cdec right?

so what are the diffrences between them?

i mean why i should use parase rather then Cdec?

 

10x for the answer

  • Administrators
Posted
I tend to use .Parse when converting from strings as it can give you more control over what format the input can be in - it will cope with currency, decimals, thousands seperators, hex, whitespace etc. If users are typing in these values you never know if they will try to be a bit clever and put these things in.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...