VB2005 Text.index 問題

2007-12-04 11:36 pm
textbox1.text="234,2552,567"
For I As Integer = 0 To TextBox1.Text.Length - 1
If TextBox1.Text.IndexOf(",") = I Then
TextBox2.Text += i

End If
Next
呢個方法只能搵到第一個"," 即係index只能找到=3
有咩方法可以搵晒咁多個index

回答 (1)

2007-12-05 5:37 am
✔ 最佳答案
裡建議改用instr
dim intStart as integer
textbox1.text="234,2552,567"
For I As Integer = 0 To TextBox1.Text.Length - 1
If instr(intStart, textbox1.text,",") > intStart Then
intStart=instr(intStart, textbox1.text,",")
TextBox2.Text += i
End If
Next
參考: me


收錄日期: 2021-04-13 14:38:31
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20071204000051KK01328

檢視 Wayback Machine 備份