我正在使用 VB.NET,我是 VB.NET 的新手,我尝试使用文本框和按钮通过加法、减法、乘法和除法等计算来制作简单的表格。对于我的项目,我需要使用三个公式计算三个值。然后需要将三个值相乘以获得最终值。
以下是使用的公式:
可用性 =(运行时间 - 停机时间)/运行时间 x 100
性能效率=(理论循环时间x处理量)/操作时间x 100
质量率=(加工量-缺陷量)/加工量x 100
整体设备效率 = 可用性 x 性能效率 x 质量率
我设法获得了 3 个公式的值,但是每当我尝试获得最终值(整体设备效率 = 可用性 x 性能效率 x 质量率)时,我得到的值仍然是 0,而我计算的所有其他值都转为 0 为好。我将在下面发布我的代码,非常感谢任何帮助。感谢您的时间和耐心:)
Public Class OEE
Private Sub OEE_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim number1 As Integer
Dim number2 As Integer
Dim answer1 As Decimal
Dim sum1 As Integer
Dim sum2 As Integer
number1 = TextBox5.Text
number2 = TextBox6.Text
sum1 = number1 - number2
sum2 = number1 * 100
answer1 = sum1 / sum2
TextBox4.Text = answer1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim number3 As Integer
Dim number4 As Integer
Dim number5 As Integer
Dim answer2 As Decimal
Dim sum3 As Integer
Dim sum4 As Integer
number3 = TextBox2.Text
number4 = TextBox11.Text
number5 = TextBox5.Text
sum3 = number3 * number5
sum4 = number4 * 100
answer2 = sum3 / sum4
TextBox1.Text = answer2
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim number6 As Integer
Dim number7 As Integer
Dim answer3 As Decimal
Dim sum5 As Integer
Dim sum6 As Integer
number6 = TextBox11.Text
number7 = TextBox8.Text
sum5 = number6 - number7
sum6 = number6 * 100
answer3 = sum5 / sum6
TextBox7.Text = answer3
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim answer1 As Decimal
Dim answer2 As Decimal
Dim answer3 As Decimal
Dim total As Decimal
TextBox4.Text = answer1
TextBox1.Text = answer2
TextBox7.Text = answer3
total = answer1 * answer2 * answer3
TextBox10.Text = total
End Sub
Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
End Sub
End Class