-
Nov 8th, 2016, 12:47 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Comma conversion to dot help? read desc
Code:
Public Class Form1
Dim firstnum As Decimal
Dim secondnum As Decimal
Dim operations As Integer
Dim operator_selector As Boolean = False
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Select()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox1.Select()
End Sub
Private Sub btnplus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnplus.Click
firstnum = Val(TextBox1.Text)
TextBox1.Text = ""
operator_selector = True
operations = 1
TextBox1.Select()
End Sub
Private Sub btnminus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnminus.Click
firstnum = Val(TextBox1.Text)
TextBox1.Text = ""
operator_selector = True
operations = 2
TextBox1.Select()
End Sub
Private Sub btnmnozenje_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmnozenje.Click
firstnum = Val(TextBox1.Text)
TextBox1.Text = ""
operator_selector = True
operations = 3
TextBox1.Select()
End Sub
Private Sub btndelenje_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndelenje.Click
firstnum = Val(TextBox1.Text)
TextBox1.Text = ""
operator_selector = True
operations = 4
TextBox1.Select()
End Sub
Private Sub btnresult_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnresult.Click
If operator_selector = True Then
secondnum = Val(TextBox1.Text)
If operations = 1 Then
TextBox1.Text = firstnum + secondnum
ElseIf operations = 2 Then
TextBox1.Text = firstnum - secondnum
ElseIf operations = 3 Then
TextBox1.Text = firstnum * secondnum
Else
If secondnum = 0 Then
TextBox1.Text = "Cannot divide by zero."
Else
TextBox1.Text = firstnum / secondnum
End If
End If
TextBox1.Select()
TextBox1.SelectionStart = TextBox1.SelectionStart + 16
TextBox1.SelectionLength = 0
End If
End Sub
End Class
when i divide firstnum 5: second num: 2, i got result 2,5 i want comma to be converted to dot can anybody help me?
-
Nov 8th, 2016, 02:14 PM
#2
Hyperactive Member
Re: Comma conversion to dot help? read desc
 Originally Posted by AceDuk
i want comma to be converted to dot can anybody help me?
This will convert all your commas to dots.
vb.net Code:
TextBox1 .Text = TextBox1 .Text.Replace(",", ".")
-
Nov 8th, 2016, 03:04 PM
#3
Thread Starter
Hyperactive Member
Re: Comma conversion to dot help? read desc
Thank you
Last edited by AceDuk; Nov 8th, 2016 at 03:09 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|