你如何通过checkstate改变计算? [英] How do you get calculations by checkstate changed?
本文介绍了你如何通过checkstate改变计算?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果检查状态发生变化,如何完成计算?
我正在尝试通过checkstate.change事件args进行一些计算,但如果我运行它,它就不起作用。
结果是0而结果不算是0.
这是我到目前为止所做的:
How to get calculations done if a check state changes?
I am trying to do some calculations by checkstate.change event args but if i run it, it does not work.
The results is 0 whiles the results is not suppose to be 0.
This is what i have done so far:
Private Sub Vehicle_Fuel_DriverCheckBox_CheckStateChanged(sender As Object, e As EventArgs) Handles Vehicle_Fuel_DriverCheckBox.CheckStateChanged
Try
If Vehicle_Fuel_DriverCheckBox.CheckState = True Then
Dim TotalCashEmoluments As Integer
Dim VFDLmt As Integer
Dim VHF As Integer
Dim TotalVHF As Integer
' Calculating VFD
VHF = TotalCashEmoluments * 0.125
'Checking and deducting with limits
If VHF = VFDLmt Then
TotalVHF = VFDLmt
End If
If VHF > VFDLmt Then
TotalVHF = VFDLmt
End If
If VHF < VFDLmt Then
TotalVHF = VFDLmt + 0
End If
End If
Catch ex As Exception
MessageBox.Show(ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
推荐答案
当你这么做时
When you do
VHF = TotalCashEmoluments * 0.125
您的变量TotalCashEmolument根本没有初始化!
这意味着在VB.NET中它是0.这就是为什么你的结果也是0!
your variable TotalCashEmolument is not initialized at all!
That means in VB.NET that it is 0. That is why your result is 0 as well!
这篇关于你如何通过checkstate改变计算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文