Solved

A very weird One..

Posted on 2000-03-13
12
140 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:ravink
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2613675
Place a couple of DoEvents before and after your call to the function.
0
 

Author Comment

by:ravink
ID: 2613704
I did that, but no use. Still it behaves in the same way
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2613734
We need code in order to see what it can be!
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:ravink
ID: 2613757
How do you want me to send the code...?
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2613777
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
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2613790
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
 
LVL 2

Expert Comment

by:Slava_K
ID: 2613834
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
 

Author Comment

by:ravink
ID: 2613955
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
 

Author Comment

by:ravink
ID: 2614253
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
 
LVL 27

Expert Comment

by:Ark
ID: 2614320
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
 

Author Comment

by:ravink
ID: 2614463
Ark
  It worked. Thanks
Answer the question, I will accept.
0
 
LVL 27

Accepted Solution

by:
Ark earned 200 total points
ID: 2614503
Hi
Change my comment to answer
Cheers
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now