Dim c As Integer
For c = 0 To Val(Form1.Text3.Text)
Label11(k).Caption = "Form1.Text4.Text" & Val(Form1.Text1.Text) + c
Next c我这样是错的为什么?

解决方案 »

  1.   

    Dim c As Integer
    For c = 0 To Val(Form1.Text3.Text)-1
       Label11(c+k).Caption = Form1.Text4.Text & Val(Form1.Text1.Text) + c
    Next c
    如果Label11是从0开始赋,则k=0.
      

  2.   

    dim strx1 as string
    dim strx2 as string
    dim strx as string
    dim xx as integer
    strx1 = text1.text
    for xx = 1 to cint(text2.text)   '// 自己检查数据是否有效
       strx1 =  strx1 & xx & vbcrlf   '//增加了换行显示
    next
    lable.caption = strx1
      

  3.   

    条件text1="L", text2=5, c=2
    你要的效果
    1,一个lable显示两行
    for i=0 to c
      lbl.caption=lbl.caption & text1.text &  cint(text2.text)+i  & vbcrlf
    next i
    2.两个lable每个显示一行,首先这个要看你的lable数组的下标是否一致了。如果lable的下标从k开始
    for i=0 to c-1
      lbl(k+i)=caption=text1.text &  cint(text2.text)+i  & vbcrlf
    next i
      

  4.   

    应该能满足你的要求:Private Sub Form_Load()
        Dim c As Integer
        Dim i As Integer
        
        Label1.Caption = ""
        Text1.Text = "Text"
        Text2.Text = "2"
        c = 5
        
        For i = 0 To c - 1
            Label1.Caption = Label1.Caption & Text1.Text & CStr(Val(Text2.Text) + i) & vbCrLf
        Next i
    End Sub