[.NET] 問一個vb.net的問題...

看板Visual_Basic作者 (N )時間19年前 (2005/06/19 19:28), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
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
在檔案開頭加上 Option Strict Off
140.114.217.31 06/20, 1F
文章代碼(AID): #12jLRT_e (Visual_Basic)
文章代碼(AID): #12jLRT_e (Visual_Basic)