G
Guest
I have a form where I have created created between 1 and 20 buttons on the
form via code. Each button shows a customer name based on that customer
having an open order. This form must update itself every 1 minute to display
any new customers that may have opened orders. Now, I have no problem
initially displaying the buttons accordingly. But, when I attempt to refresh
the screen I get unexpected results. So, my goal is to remove the buttons
every 1 minute and redisplay the new set. Thus, if a new button must be
added, it will appear, or if one needs to be taken away it will be gone.
I've used the following code to create the buttons.
Dim btn as Button
For x = 1 to intNumberOfCustomers
btn.text = CustomerName
btn.name = "btn" & x
controls.add(btn)
Next x
This displays the buttons perfectly. What I need is a procedure that will
remove all of these buttons before I refresh them. The reason I need to do
this si because if I just rerun the procedure the names on the buttons are
not always correct. The number of buttons are correct, but not the labels.
So, my thought was to delete/remove all the buttons before recreating them
again. I used the following code, which does nothing.
Dim btn as button
For x = 1 to intNumberOfOrders
btn.Name = "btn" & x
Controls.Remove(btn)
Next x
What can I do to have all the dynamicly created buttons removed so I can
start all over?
form via code. Each button shows a customer name based on that customer
having an open order. This form must update itself every 1 minute to display
any new customers that may have opened orders. Now, I have no problem
initially displaying the buttons accordingly. But, when I attempt to refresh
the screen I get unexpected results. So, my goal is to remove the buttons
every 1 minute and redisplay the new set. Thus, if a new button must be
added, it will appear, or if one needs to be taken away it will be gone.
I've used the following code to create the buttons.
Dim btn as Button
For x = 1 to intNumberOfCustomers
btn.text = CustomerName
btn.name = "btn" & x
controls.add(btn)
Next x
This displays the buttons perfectly. What I need is a procedure that will
remove all of these buttons before I refresh them. The reason I need to do
this si because if I just rerun the procedure the names on the buttons are
not always correct. The number of buttons are correct, but not the labels.
So, my thought was to delete/remove all the buttons before recreating them
again. I used the following code, which does nothing.
Dim btn as button
For x = 1 to intNumberOfOrders
btn.Name = "btn" & x
Controls.Remove(btn)
Next x
What can I do to have all the dynamicly created buttons removed so I can
start all over?