[解决办法] 用全局变量的数组将你读出来的数据全部存放起来啊,然后在每个窗体将需要的数据赋给text就行了。 public strhardware() as string'全局数组变量 public hardwareNo as integer '读第几个硬件 在FORM1里给strhardware()赋值:redim strhardware(i)'这里的i是你要读取的硬件数量(此时数组下标为1) strhardware(1)="硬件1" strhardware(2)="硬件2" strhardware(3)="硬件3" strhardware(4)="硬件4" strhardware(5)="硬件5" strhardware(6)="硬件6" 然后在form1里给TEXT1(j)赋值,在form2里给TEXT1(m)赋值,在form3里给TEXT1(n)赋值 form1:hardwareNo=1 '读第一个硬件 for i=0 to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i form2:for i=0 to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i form3:for i=0 to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i [解决办法]
我的界面要求就是要FORM2窗体的TEXT控件下标从6开始 [解决办法] 晕了 那你把下面代码里FORM2里的i=0 改为你的下标就行了塞 form1:hardwareNo=1 '读第一个硬件 for i=text1.Lbound to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i form2:for i=text1.Lbound to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i form3:for i=text1.Lbound to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i
[解决办法] 写错了 form1: hardwareNo=1 '读第一个硬件 for i=text1.Lbound to text1.ubound text1(i).text=strhardware(hardwareNo) hardwareNo=hardwareNo+1 next i form2: for i=text1.Lbound to text1.ubound text1(i).text=strhardware(hardwareNo) hardwareNo=hardwareNo+1 next i form3: for i=text1.Lbound to text1.ubound text1(i).text=strhardware(i+hardwareNo) hardwareNo=hardwareNo+1 next i
[解决办法] form3里写错了 form3: for i=text1.Lbound to text1.ubound text1(i).text=strhardware(hardwareNo) hardwareNo=hardwareNo+1 next i
[解决办法]
我的要显示的控件组从0到23,原来Text1控件组23个成员在form1上显示正常,我现在要分3个到form1上,分6个到form2上,分15个到form3上显示! 以下是我在form1上显示代码,现在怎么把控件组23个成员各自分配到3个界面显示!你的这些我确实看不懂(strhardware(3)="硬件) Case 3 'T For I = 0 To 23 Text1(I) = Val("&H" + Mid(getData, I * 4 + 3, 2) + Mid(getData, I * 4 + 1, 2))
Dim txt As TextBox Set txt = Form1.Text1(2) Load txt txt.Top = 0 txt.Visible = True End Sub
[解决办法]
这容器就是窗体本身. [解决办法] 我真的很晕 你在其它窗体里也创建TEXT数组控件,然后将strhardware数组里的值相应的赋给其它窗体里的text控件不就行了吗? public strhardware() as string'全局数组变量 public hardwareNo as integer '读第几个硬件(全局变量)
FORM1里先给数组赋值(全局数组变量),然后再将strhardware相应的值给FORM1里的text For I = 0 To 23 strhardware(I+1) = Val("&H" + Mid(getData, I * 4 + 3, 2) + Mid(getData, I * 4 + 1, 2)) Next I
hardwareNo=1 '读第一个硬件 for i=text1.Lbound to text1.ubound text1(i).text=strhardware(hardwareNo) hardwareNo=hardwareNo+1 next i FORM2窗体: for i=text1.Lbound to text1.ubound text1(i).text=strhardware(hardwareNo) hardwareNo=hardwareNo+1 next i FORM3窗体: for i=text1.Lbound to text1.ubound text1(i).text=strhardware(hardwareNo) hardwareNo=hardwareNo+1 next i 你如果还看不懂我就没办法了 [解决办法] 楼上代码为form2的load过程 [解决办法]