English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

vb如何把幾個文字方塊內的字刪除???
現在己經把文字方塊設定為 a = Val(Text1.Text) 到 i = Val(Text9.Text) 有9個
要怎麼用一個按鈕把這9個文字方塊裡的字都刪除呢?

2006-06-08 05:48:20 · 3 個解答 · 發問者 ? 1 in 電腦與網際網路 程式設計

3 個解答

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objText() As Object = {TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6, TextBox7, TextBox8, TextBox9}
Dim obj As Object
For Each obj In objText
obj.text = ""
Next
End Sub
只能如此,還是要一一指定陣列對應的textbox 元件
只程式一定可run,方法百百種,就看利不利落

2006-06-09 17:13:04 · answer #1 · answered by 亞奇 1 · 0 0

Private Sub Command1_Click()        Dim I As Integer                For I = 1 To 9            Controls("Text" & I).Text = ""        NextEnd Sub

2006-06-08 11:41:22 · answer #2 · answered by W.J.S. 7 · 0 0

'先建立TextBox物件陣列(0~8,共9個)
'選取物件複製貼上就可以建立物件陣列了
For i = 0 To 8
  Text1(i).Text = ""
Next i
----------------------
你要的是這樣嗎?

2006-06-08 06:01:18 · answer #3 · answered by 以晴 2 · 0 0

fedest.com, questions and answers