VB.Net中可以用CType函数 比如: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '强制转换位整型 MsgBox(CType(ListBox1.SelectedItem, Integer)) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.ListBox1.Items.Add("111") Me.ListBox1.Items.Add("222") End Sub
比如:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'强制转换位整型
MsgBox(CType(ListBox1.SelectedItem, Integer)) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ListBox1.Items.Add("111")
Me.ListBox1.Items.Add("222")
End Sub