Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic TextBox 1

Status
Not open for further replies.

aharris2693

Programmer
Jul 15, 2003
45
US
I am looping through an Access database and for each record, creating a text box to display 1 field from each record. The problem is that the field is a memo and therefor some records are quite long. I have tried to set the multiline property to true, but I get errors everytime I use this property. My code is below. Thanks in advance for any help.

Do Until dbRS.EOF
ReDim txtName(i)
If i = 1 Then
Set txtName(i) = Me.Controls.Add("vb.textbox", "txtBox", Me)

txtName(i).Visible = True
txtName(i).Left = 120
txtName(i).Top = commentLeft
txtName(i).Height = 975
txtName(i).Width = 4095
txtName(i).Enabled = True
txtName(i).Locked = False
txtName(i).MultiLine = True 'error caused here
txtName(i).Text = dbRS("Comment")
End If
dbRS.movenext
Loop


 
The MultiLine property is Read-Only at run time. If you want to edit the text you may need to use something like an RTF control rather than a text box.

If there's some known upper limit to the number of text boxes that you will have then you could just create them all at design time and then hide (txtName(i).Visible = False) the ones that you don't need.
 
Thanks Golom,
I had a feeling that was the case, but I was hoping otherwise. Thanks also for the very quick response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top