這裏我有我的簡單代碼,包含數組的列表和2個文本框,當我按下按鈕腳本時,必須檢查文本是否在數組列表中找到Textbox2。你能幫我解決它嗎? 謝謝!檢查數組中是否存在textbox.text
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim pins() As String = {"dgge", "wada", "caas", "reaa"}
If TextBox2.Text = pins() Then
TextBox1.Text = "Succes"
End If End Sub
'如果pins.IndexOf(textBox2.Text)< > -1 Then ... End If'(假設我記得VB正確。)ps另見:http://stackoverflow.com/a/11112305/298053 – 2013-02-22 20:16:28