How to Convert Number to Currency in Textbox Using VB.Net
This tutorial is all about Converting a Number to Currency in Textbox Using VB.Net. In this post you will learn How to Convert Number to Currency in Textbox Using VB.Net.
What is TextBox Control and how does it work?
You can use the TextBox Control to enter text into your form while it’s running. It will accept only one line of text by default, but you can change this to accommodate additional lines. Scroll bars can even be included in your TextBox Control.
Events in Textboxes
The goal of events is to make the TextBox Control react to user actions such as a click, double click, or text alignment change. The TextBox Control has the following common events:
AutoSizeChanged– Triggered when the AutoSize property is changed.
ReadOnlyChanged– Triggered when the ReadOnly property value is changed.
A click on the TextBox Control causes this to happen.
So let’s get started:
- First is open the Visual Basic, Select File on the menu, then click New and create a new project.
- Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK
- Then design your form like this just like what I’ve shown you below
Add a Label, 2 Textbox, and Button. - Add this code to the Convert Button:
[vbnet]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = FormatCurrency(TextBox1.Text, , , TriState.True, TriState.True)
End Sub
[/vbnet]
Download Source Code! here
Readers might read also:
If you have any comments or suggestions about on this tutorial. Please feel free to contact our webpage.