[.NET] 問一個vb.net的問題...
Dim m_intChoices As String() = New String() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Dim m_receive As Integer() = New Integer(9) {}
Sub DisplayHistogram()
Dim intRatings, intCounter As Integer
Dim strOutput As String
For intRatings = 1 To 10
For intCounter = 0 To m_receive(intCounter)
strOutput &= "*"
Next
strOutput &= ControlChars.CrLf
Next
End Sub ' DisplayHistogram
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim intindex As Integer = 0
Dim strcboRate As String = Convert.ToString(cboRate.SelectedValue) '將
使用者選的值給變數
Dim intTotal As Integer
cboRate.DataSource = m_intChoices
For intindex = 0 To m_intChoices.GetUpperBound(0)
If strcboRate = m_intChoices(intindex) Then '跟原定的intChoice陣
列裡面數字比
m_receive(intindex) += 1 '對的話在另一各Array 累加
End If
Next
DisplayHistogram()
End Sub
End Class ' FrmCafeteriaSurvey
為什麼我上面這行
Dim m_intChoices As String() = New String() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
數子下面會有~ 然後說不允許integer 到string的隱含轉換~~
謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 221.169.15.183
推
140.114.217.31 06/20, , 1F
140.114.217.31 06/20, 1F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章