我目前正在尝试浏览用户添加到列表框中的所有值,但是,我想检索列表框中每个项目的实际值,而不是文本。
到目前为止,我已经了解了下面的代码,但这只会获取文本而不是值。
For Each item In SelectedStoresLB.Items
Dim tCompany As Integer = CInt(Left(item.ToString, 1))
Dim tStore As String = Right(item.ToString, 3)
Dim tReason As String = ReasonTxt.Text
insertSQL = "INSERT INTO [CommsDownLog] ([DimCompanyID],[PervasiveStoreNumber],[DownReason]) VALUES (" & tCompany & ", '" & tStore & "', '" & tReason & "')"
Dim insertRow = New SqlCommand(insertSQL, objConn)
Try
objConn.Open()
insertRow.ExecuteNonQuery()
objConn.Close()
Catch ex As Exception
Response.Write(ex)
End Try
Next
我将如何获取集合中每个项目的价值?