Unloading of controls

I have created one combobox.Then i added 10 , ten digit numbers.After selecting one of these numbers ,in click event of this combo box i am calling one function named Display_Operations.
In this function i am retrieving the data for corresponding selected number( from combo box).Database is SQL server.
In data base there is data for every ten digit number added to combobx.
During design time i have created one label by selecting it from tool box and dropped on to the FOM.

 Now suppose there are 20 operations ( data ) for selected ten digit number.
So in function which i am calling in click event of combobox creates the array of controls i.e. i am using Load
statement.After doing this i have created 20 labels ( array of labels) and data which nothing but operation names , i am showing on caption of these labels.

Now my question is -- When i change the
number on combo box by clicking it,
I want first unload the controls ( array of labels ) created for earlier ten digit number , and then reload the controls and display the operation name
for newly selected number.

But it doesn't allow me to unload the controls on any combo box event.As we all know that any control can not be unloaded in any combobox event.

This is the customer requirement that if i change the number it should show me the operation names corresponding to that number.

What is the solution..?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If your only displaying data for one set of operations at a time then why cant you just change the label captions instead of unloading and reloading ..just use the same labels and change appropriate properties.
What you can do is place a timer onto the form and place your unload controls method into a seperate sub.

do as follows:

Private Sub Combo1_Change()
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
   'call unload subroutine
   timer1.enabled = false
End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sorry about the rushed description But I think  you should understand what I mean.

If you set the timer1.interval property to 1 the timer event will occur 1ms after you enable the timer so it is not causing a daley.

So place timer onto the form.

Write a sub eg. unloadControls

when the combo box event occurrs that you want to unload the controls in enable the timer.

From the timer event unload the controls or perform any other code as is desirred and then set the timer enabled property to false again



cvjoshiAuthor Commented:
Adjusted points to 80
cvjoshiAuthor Commented:

 Hi, James

 I have modified code. Now it works fine.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.