2

当我想这样做时有没有办法:

textbox1.text = x + i  
textbox2.text = x + i  
textbox3.text = x + i  

例如这样做?

for l = 0 to 2   
  textbox(l) = x + i  
next  
4

1 回答 1

6

假设这些控件位于用户窗体中,请执行以下操作:

Private Sub FillTextboxes()
    Dim i As Long
    Dim x As Long

    x = 10
    For i = 0 To 2
        Me.Controls("textbox" & i + 1).Text = x + i
    Next i
End Sub
于 2012-11-10T23:06:01.630 回答