473,378 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Show Currency

144 100+
hello,

i have a textbox for product price that the user will be able to enter some number and also a column in a datagridview to show the same price too,

is it possible to show the thousands separator as a user types in. like when a user types 1000, it will be shown as 1,000. and if it possible, when i get the value in the textbox, can i convert it to an integer?

thank you
Nov 1 '08 #1
2 1150
kspiros
16
In order to convert a value to an integer you can do two things
you can use this
Expand|Select|Wrap|Line Numbers
  1. X=Convert.ToInt32(textBox.Text);
or this
Expand|Select|Wrap|Line Numbers
  1. X=Int32.Parse(textBox.Text) ;
Nov 1 '08 #2
joedeene
583 512MB
You can do something like this for the thousandths place...

Expand|Select|Wrap|Line Numbers
  1. private void textBox1_TextChanged(object sender, EventArgs e)
  2.         {
  3.             if (textBox1.TextLength == 4)
  4.             {
  5.                 textBox1.Text = textBox1.Text.Insert(1, ",");
  6.  
  7.             }
  8.  
  9.         }
But after it inserts the text it brings the cursor to the beginning of the textbox. :( Why not have a button and parse the text and then you can convert it to an integer within that function too.

joedeene
Nov 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dalan | last post by:
This should not be an issue, but it is. I'm sure that someone knows what little piece of code is needed too persuade Access 97 to include a currency format for labels (Avery, mailing type). Have...
3
by: Dalan | last post by:
Is there any code available to address currency rounding problems in Access 97? Apparently, selecting currency type table fields does not resolve the problem. For instance, in my form I have a...
3
by: news.shaw.net | last post by:
I have a subform that contains a currency field. If I tab my way to the field, everything works as desired, a number can be entered, and when I leave the field it is rendered as a currency...
3
by: Dave Stone | last post by:
This question appeared years ago in the context of Acc2K and SQL Server 7, but no replies were posted. HOWEVER!! It still seems to be a problem with Acc XP and SQL Server 2000. Surely someone has a...
2
by: Alberto | last post by:
I have a decimal field in a SQL Server DataBase who stores money and I want to show it in a TextBox and in a ListView controls in C#. If I do: txtMoney.Text = Convert.ToSingle(dr); I see...
11
by: Adrian | last post by:
Hi I want to use the following declarations but vb dotnet keeps complaining that currency can't be used because it private ? I have tried it in a module and in the declaration pare same error!...
7
by: meenasamy | last post by:
Hi all, i need to create a function that takes three parameters( Original currency, needed currency, amount) i need to convert from the original currency to the needed currency the amount and...
16
by: xjohnx | last post by:
Hi, I'm hoping someone can help me I am quite new to Javascript and have had to create a programme which converts dollars into euros and vice versa, here is my script which is working var...
25
by: mereba | last post by:
Hello My country Ghana is changing its currency. I want to write a small programme in C++ that can covert from the old currency into the new one. I would like this programme to run behind a simple...
2
by: mahesh123 | last post by:
Hi Folks, I am information regarding the Changing the Indian Currency to USD Currency. How can we change the Indian Currency to USD Currency. For example if the Indian Currency is 100 rs then the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.