vb根据数据库内容多少 动态创建文本框

但不是在网页上,而且要更据数据库内容,全部查询的数据显示动态控件内容

定义文本框数组
假设已存text1(0)文本框
使用以下操作动态创建文本框
load text1(i)
text1(i).visible=true
再调整text1(i)的左、上、和长度、高度
其中i为正整数,text1(i)不能重复加载追问

这样好像不行,我只能看到一个控件,楼主能不能写一个全面性一点的代码,急急啊.帮帮忙~

追答

以下为Form1.Frm文件内容
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3030
ClientLeft = 120
ClientTop = 450
ClientWidth = 4560
LinkTopic = "Form1"
ScaleHeight = 3030
ScaleWidth = 4560
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 375
Left = 2880
TabIndex = 1
Top = 480
Width = 1455
End
Begin VB.TextBox Text1
Height = 375
Index = 0
Left = 480
TabIndex = 0
Text = "Text1"
Top = 0
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 3
If i > Text1.UBound Then
Load Text1(i)
Text1(i).Top = Text1(i - 1).Top + 500
Text1(i).Visible = True
End If
Next
End Sub

温馨提示:答案为网友推荐,仅供参考
相似回答