PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2010 [RESOLVED] Comma conversion to dot help? read desc-VBForums
Results 1 to 3 of 3

Thread: [RESOLVED] Comma conversion to dot help? read desc

  1. #1

    Thread Starter
    Hyperactive Member AceDuk's Avatar
    Join Date
    Jan 2016
    Location
    Macedonia
    Posts
    465

    Resolved [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?

  2. #2
    Hyperactive Member Vexslasher's Avatar
    Join Date
    Feb 2010
    Posts
    429

    Re: Comma conversion to dot help? read desc

    Quote Originally Posted by AceDuk View Post
    i want comma to be converted to dot can anybody help me?
    This will convert all your commas to dots.
    vb.net Code:
    1. TextBox1.Text = TextBox1.Text.Replace(",", ".")

  3. #3

    Thread Starter
    Hyperactive Member AceDuk's Avatar
    Join Date
    Jan 2016
    Location
    Macedonia
    Posts
    465

    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
  •  



Featured


Click Here to Expand Forum to Full Width