列表框值计算

时间:2017-11-13 03:46:05

标签: vb.net visual-studio

当我测试时,这会将数量和数量的文本框重置为零,如何进行此计算?

Dim Number As Integer

txtNumber.Text = Number

Dim orchestra As Integer = 40
Dim mezz As Integer = 27.5
Dim general As Integer = 15
Dim balcony As Integer = 10

If lstSection.SelectedItem = "Orchestra" Then
  txtAmount.Text = (Number * 40)
ElseIf lstSection.SelectedItem = "Mezzanine" Then
  txtAmount.Text = (Number * 27.5)
ElseIf lstSection.SelectedItem = "General" Then
  txtAmount.Text = (Number * 15)
ElseIf lstSection.SelectedItem = "Balcony" Then
  txtAmount.Text = (Number * 10)
End If

1 个答案:

答案 0 :(得分:0)

假设我的编辑是正确的,并且您打算在同一方法中声明Number变量,那么您所看到的问题正在发生,因为您没有为Integer分配值。< / p>

0值类型始终使用默认值txtAmount.Text = (0 * 40)进行初始化。

因此:0,当然永远是["pamela.jpg"]{"jquery-upload-file-error":"Image file could not be found!"}