This tutorial will show you how to convert number to currency using VB.Net. I use two Textboxes whic is one(TextboxNumber) for input number and another one(TextboxCurrency) for show the result of converting and I use one button(ButtonConvert) with Click_Event for process the code.
No | Control type | Name | Text | Event |
1 | Form1 | FormConvertCurrency | Convert Currency | |
2 | Textbox1 | TextboxNumber | ||
3 | Textbox2 | TextboxCurrency | ||
4 | Button1 | ButtonConvert | Convert | Click |
- As you see in the application screenshot, I input 324 into TextboxNumber then I click on ButtonConvet, the result show in TextboxCurrency is "$324.00". To convert from number to currency like this I use "FormatCurrency()" method.
Code
Public Class FormConvertCurrency
Private Sub ButtonConvert_Click(sender As Object, e As EventArgs) Handles ButtonConvert.Click
TextBoxCurrency.Text =
FormatCurrency(TextBoxNumber.Text)
End Sub
End Class
0 comments:
Post a Comment