Link to home
Start Free TrialLog in
Avatar of cvjoshi
cvjoshi

asked on

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..?

Avatar of crazyman
crazyman
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
ASKER CERTIFIED SOLUTION
Avatar of James_stillman
James_stillman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James_stillman
James_stillman

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

Cheers

James

Avatar of cvjoshi

ASKER

Adjusted points to 80
Avatar of cvjoshi

ASKER


 Hi, James

 I have modified code. Now it works fine.

 Regards

 Chintamani