[英]Vb.net how to add value of array?
看起來是這樣的:
Dim a As Integer
a = ComboBox1.SelectedItem()
Label1.Text += a
我想添加從combobox1中選擇的所有值
如果我正確理解以下是OP尋找的代碼,
Dim intVal As Integer
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedValueChanged
If Label1.Text = String.Empty Then
Label1.Text = ComboBox1.SelectedItem.ToString
intVal = Convert.ToInt32(ComboBox1.SelectedItem)
Else
Label1.Text = Label1.Text & "+" & ComboBox1.SelectedItem.ToString
intVal = intVal + Convert.ToInt32(ComboBox1.SelectedItem)
End If
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.