Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27367

new to vb and need a little help

$
0
0
hey everyone as the title says im new to vb and i have come up stuck, basically if you take a look at the image below you will see on my output textboxes there is alot of numbers after the decimal point, basically i need to remove all those, so for example in the first box aafter calculate the number is: 2222.22222222222 and basically i just want it to be 2222, and same for all the others too

also i do not know what numbers will be typed into the top 3 boxes to calculate the bottom boxes.



here is my code (not the tidest code :()

Code:

Public Class Form1

    Private Sub Button4_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.MouseHover
        Label4.Visible = True
    End Sub

    Private Sub Button4_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.MouseLeave
        Label4.Visible = False
    End Sub

    Private Sub Button3_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.MouseHover
        Label5.Visible = True
    End Sub

    Private Sub Button3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.MouseLeave
        Label5.Visible = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    End Sub

    Private Sub Button2_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.MouseHover
        Label6.Visible = True
    End Sub

    Private Sub Button2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.MouseLeave
        Label6.Visible = False
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Panel1.Visible = False
        TextBox4.Text = Val(TextBox3.Text) / Val(TextBox1.Text)
        TextBox5.Text = Val(TextBox4.Text) * (1.4 / 100 * 10)
        TextBox6.Text = Val(TextBox5.Text) + Val(TextBox4.Text)
        TextBox8.Text = Val(TextBox6.Text) * Val(TextBox2.Text)
        TextBox7.Text = Val(TextBox8.Text) - Val(TextBox3.Text)
        TextBox9.Text = Val(TextBox6.Text) / (14) * (15) / (60)



    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox1.Text = Val(" ")
        TextBox2.Text = Val(" ")
        TextBox3.Text = Val(" ")
        TextBox4.Text = Val(" ")
        TextBox5.Text = Val(" ")
        TextBox6.Text = Val(" ")
        TextBox7.Text = Val(" ")
        TextBox8.Text = Val(" ")
        Panel1.Visible = True

    End Sub
End Class


Viewing all articles
Browse latest Browse all 27367

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>