visual basic救命!!

2010-12-09 9:14 am
我係combo box揀...另一個格會顯示個金錢出來點打??
如我combo box選a....個label立即會出$10 combo box選b....個label立即會出$20
更新1:

If Me.ComboBox1.SelectedItem = "a" Then Me.Label1.Text = "$10" ElseIf Me.ComboBox1.SelectedItem = "b" Then Me.Label1.Text = "$20" End If 行吾到

回答 (2)

2010-12-12 1:59 am
✔ 最佳答案
樓主既code 的確無錯

而me.combobox1..... 既me. 可免則免
太長只會係自己debug 既負累...

你要肯定你combobox 入面果舊野係 完全相同先可以有效果

試下自己搵d 方法 debug
例如而家呢度

Select Case Combobox1.SelectedItem
Case "a"
Label1.Text = "$10"
Case "b"
Label1.Text = "$20"
Case Else
Label1.Text = "Nothing(" & Combobox1.SelectedItem & ")"
Debug.Print( Combobox1.SelectedItem )
End Select

睇下會唔會多左d 咩空白之類
2010-12-09 12:25 pm
If Me.ComboBox1.SelectedItem = "a" Then
Me.Label1.Text = "$10" ElseIf Me.ComboBox1.SelectedItem = "b" Then
Me.Label1.Text = "$20"
End If

2010-12-09 10:05:50 補充:
我run到
你有冇系個 combo box 到 + a 同 b?


收錄日期: 2021-04-23 23:06:26
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20101209000051KK00066

檢視 Wayback Machine 備份