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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I dymanically load a Textbox into a picturebox?

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
0
0
US
Hi,


How can I dymanically load a Textbox into a picturebox?
 
What JohnYingling said works (of course since he is a top expert ;-) ).

If you want to create the textbox at
runtime, you can create it and add it to
a Picture box (called Picturebox1) at
runtime with this code...

Dim WithEvents text1 As TextBox

Private Sub Command1_Click()
' the third parameter here sets Picturebox1 as container.
Set text1 = Controls.Add("VB.TextBox", "text1",Picturebox1)
text1.Left = 50
text1.Top = 50
'these positions are relative to the picture box
text1.Visible = True
End Sub


If you wanted to do something simpler, maybe you could
put the textbox in the Picture box at design time
and just make it visible when you want to display it.
(depends what you want to do with it I guess)

have fun.
 
I have a similar Question,

I want to add a TextBox to FormControls and Set the index.When try to set the index I am getting an Error [382]

"'Index' property can't set at Runtime" .Is there ant other
way to do this?.

( I don't want to place a TextBox with 0 Index on the form at design time)
 
I really can't think of a way to do this.
:-I
Anyone...
 
Nanapaneni, maybe you should re-post your question
as a separate thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top