Speed up Frame1.Clear???

jackass209

New Member
Joined
Jul 14, 2007
Messages
49
I have a Frame on a UserForm. The Width of the frame depends on values given in TextBox.Dat1 and TextBox.Dat2.

Now I tried it with a width of 2200 with a scroll bar, but when I change the value in the Textboxes I need the Frame to be cleared. Now this is my question. I use "UserForm1.Frame1.Clear" but this can take up to 1 minute.

Is there anyway to speed this up???

Hope someone can help me.
Thanks in advance!
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Hi

I'm no expert in this area of vb, so bear with me - why are you clearing the frame? Do you need to replace the contents of the frame with something else?
 
Upvote 0
Hi Richard,

Yeah that's the reason. I have 2 textboxes with dates.
and in the Frame I have names of Students on the left.
And on the right of the names in the same frame I have it show the status whether the Student was absent, present, sick, late, etc. for each date in the period of Textbox1 and Textbox2.

So when the date or value in combobox1 (which holds the class) is being edited it needs to show a new list.

Hope it's more clear like this.
And thanks for your reply!
 
Upvote 0
Hmm, my thoughts were to maybe use something like the Repaint command rather than Clear - assuming the values of the controls in the frame have been changed in your code (ie in response to the user inputs) I think this might be faster.
 
Upvote 0
I tried the repaint option but all the old values stay in frame1.
It doesn't clear it.

Know any other tricks by any chance?
And again... thanks for your reply.
 
Upvote 0
The controls are labels.

I add them with this code:

Dim MyControl As Control
Set MyControl = RegRap.Frame1.Controls.Add("forms.Label.1")
 
Upvote 0
Ah. Do you need to dynamically increase the number of labels then? Adding will definitely be slower than simply assigning a new value to an existing control. Maybe you could rethink how you are applying the new values into the controls in the frame?
 
Upvote 0
True. But for adding the labels I've got a progress bar so I can see how long it's gonna take kinda.

I put a "break point"? right after the Frame1.Clear and I tried it right before and I noticed that is the point that takes too long.

So that's why I hoped there be an option to make that go faster.
But it sounds like there isn't any, huh?
 
Upvote 0
Well, never say never, but I'm afraid it's going to take someone more knowledgeable than I to provide an alternative. Have you considered simply deleting all the frames on the Frame rather than using the Clear command?
 
Upvote 0

Forum statistics

Threads
1,214,859
Messages
6,121,963
Members
449,059
Latest member
oculus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top