im just wondering if visual basic has the ability to add buttons(command button,option,checkbox and the likes) during runtime?
for example , you want to have a list of supplier to be handled by the radio button.. but then during the coding process you dont know yet how many supplier there would be, so you want to write a program that would automatically add radio button everytime a new supplier added..
if it's possible, how? or do you have some techniques do such?
Q: adding buttons during runtime?
Started by encio, Jun 20 2010 11:48 PM
4 replies to this topic
#1
Posted 20 June 2010 - 11:48 PM
|
|
|
#2
Posted 21 June 2010 - 04:05 AM
Dim myButton As New Button myButton.Parent = Me myButton.Size = New Size(40,20) myButton.Location = New Point(10,10)
#3
Posted 21 June 2010 - 05:22 PM
ok, how do you call it?
Dim myButton As New Button
dim x,y as integer
x = adodc1.recordset.recordcount
for y = 1 to x
myButton.Parent = Me
myButton.Size = New Size(40,20)
myButton.Location = New Point(10,10)
next y
what it does is it will place the button of the top of each other right?
Dim myButton As New Button
dim x,y as integer
x = adodc1.recordset.recordcount
for y = 1 to x
myButton.Parent = Me
myButton.Size = New Size(40,20)
myButton.Location = New Point(10,10)
next y
what it does is it will place the button of the top of each other right?
#4
Posted 22 June 2010 - 03:59 AM
in your example it will only create one button since your creation is outside the loop:
The size and locations were of course just examples, if you want them to be different in a loop you can just use the loop variable to change the location accordingly:
Dim myButton As New Button
The size and locations were of course just examples, if you want them to be different in a loop you can just use the loop variable to change the location accordingly:
myButton.Location = New Point(10,30*y)for example...
#5
Posted 22 June 2010 - 05:32 PM
oohh.. okay, i get the point.. thanks for your help, i'm just starting with visual basic so i had to ask those nooby question.
again thank you!
again thank you!


Sign In
Create Account


Back to top









