A very weird One..

I created an active-X control in visual basic, it has a function "CreateChart", creates a chart diagram. And I am using this control on some other form in a different project. If I have "CreateChart" function in the form load, it works. If I have this function in a command button click, it does not work. and If I go in debug mode through command button click, it works. Do you have any suggestions for it to make work from Command button click?
ravinkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ArkConnect With a Mentor Commented:
Hi
Change my comment to answer
Cheers
0
 
Éric MoreauSenior .Net ConsultantCommented:
Place a couple of DoEvents before and after your call to the function.
0
 
ravinkAuthor Commented:
I did that, but no use. Still it behaves in the same way
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Éric MoreauSenior .Net ConsultantCommented:
We need code in order to see what it can be!
0
 
ravinkAuthor Commented:
How do you want me to send the code...?
0
 
wsh2Commented:
First things first.. is your VB up to date, ie. Service Pack 3? If not.. get it done.. <smile> and a <wink>.

After that, can you tell us a little more about your Chart Control.. does it use events.. external references (such as databases or variables).. are all your module level variables being saved and restored in their propertybags (InitProperty.. ReadProperty.. WriteProperty procedures).. stuff like that. How is the control's Autoredraw property set (ie.. is work being done in a paint event.. but the event is not firing because the graphics are defined persistent)?

Anyhow.. if you would.. let us know more.. <smile>.
0
 
Éric MoreauSenior .Net ConsultantCommented:
If it is simple, you can paste code here (saying what goes to the ActiveX control and what goes on the form).

If it is too big, you can send it to emoreau99@hotmail.com. Zip it and don't forget to put EE in references.
0
 
Slava_KCommented:
My guess would be that you have more then one UID for this OCX. Check your registry first, make sure it is only one instance of your control.
0
 
ravinkAuthor Commented:
wsh2, slava k
  I dont have service pack 3, I will install it now and see if it makes any difference. The control has events, and I set usercontrol's autoredraw property to true in the beginning. I checked registry, it has only one UID and i even tried registering the control on a different machine and ran the test project, which behaved in the same manner.
emoreau
 I sent you the zip files of both control program and test program.
Thanks
0
 
ravinkAuthor Commented:
wsh2
  I tried by installing sp3, but it didn't help.
Let me know if you need code to understand the problem more...
Thanks
0
 
ArkCommented:
Hi
It seems that Form_Paint event redraw your ActiveX. Try to call Form.Refresh method after calling your function or include refresh into your function.

Cheers
0
 
ravinkAuthor Commented:
Ark
  It worked. Thanks
Answer the question, I will accept.
0
All Courses

From novice to tech pro — start learning today.