Click here to Skip to main content
15,917,174 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
A user control, eg. button, should be created however many times I want when I click that button click event.

Thank You
Posted
Updated 16-Nov-10 21:51pm
v2
Comments
Dalek Dave 17-Nov-10 3:51am    
Edited for Readability.

If I understand your question correctly, you'll find the basics here.
 
Share this answer
 
dim btn as new button

btn.name = "ButtonName"
btn.text = "ButtonText"
btn.left = 100
btn.top  = 100

me.controls.add(btn)
addhandler btn.cli, addressof BtnEvent

...

public sub BtnEvent
end sub


you will need to change the section below to make sure your button is visible to the use each time else the next button to be drawn will overwrite the previous

btn.left = 100
btn.top  = 100
 
Share this answer
 
<code>you ca create buttons from textbox!
dim c as integer=10 ' this variable is for location in form, you can use for left,top
dim z as integer=100 ' this variable is for location in form, you can use for left,top
dim i as integer


for i=0 to textbox.text
dim btn as new button
btn.name="Button" & i
btn.text=i
btn.location= new drawing.point(c,z)
me.controls.add(btn)
z=z+100

next


</code>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900