要用就少在那機掰
Would you like to react to this message? Create an account in a few clicks or log in to continue.

用電 2010.9.27

向下

用電 2010.9.27 Empty 用電 2010.9.27

發表  stty0910 周一 9月 27, 2010 10:22 am

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim use_power As Integer
Dim pay As Single
pay = 0
If IsNumeric(TextBox1.Text) Then
use_power = Val(TextBox1.Text)
If use_power <= 110 Then
pay = use_power * 2.1
ElseIf use_power >= 111 And use_power <= 330 Then
pay = 110 * 2.1 + (use_power - 110) * 3.23
ElseIf use_power >= 331 And use_power <= 500 Then
pay = 110 * 2.1 + (330 - 110) * 3.23 + (use_power - 330) * 4.05
ElseIf use_power >= 501 And use_power <= 700 Then
pay = 110 * 2.1 + (330 - 110) * 3.23 + (500 - 330) * 4.05 + (use_power - 500) * 4.51
ElseIf use_power >= 701 Then
pay = 110 * 2.1 + (330 - 110) * 3.23 + (500 - 330) * 4.05 + (700 - 500) * 4.51 + (use_power - 500) * 5.1
End If
If CheckBox1.Checked Then
pay = pay * 1.15
Label2.BackColor = Color.Red
Else
Label2.BackColor = Color.Empty
End If
Label2.Text = "電費" & pay.ToString & "元"
Else
Label2.Text = "輸入度數資料錯誤"
TextBox1.Clear()
End If
End Sub

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

stty0910
終極管理員
終極管理員

文章數 : 68
注冊日期 : 2010-08-06
年齡 : 30
來自 : 地球某個角落

https://bear.666forum.com

回頂端 向下

回頂端


 
這個論壇的權限:
無法 在這個版面回復文章