繁体   English   中英

Vb.net如何增加数组的值?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM