0

My application has tow form

  • 1) Main Form
  • 2) Dashboard Form

I used a qlickview ocx control on my "Dashboard Form" and i open my QVW files with this control and everything works fine....

But if my opened QVW document has encountered an error on reload time Or in other words my OCX control has encountered a problem, my application will be hang when i try to reopen the "Dashboard Form" and open a QVW file.

Steps:

  1. Open application
  2. Create an instance of the "Dashboard Form" and Show it
  3. Open a QVW document by the OCX control on the "Dashboard Form"
  4. Fire reload command
  5. Occurring error on reload time
  6. Close the "Dashboard Form"
  7. Create an instance of the "Dashboard Form" and Show it
  8. Try to open a QVW document (the previous document or another document) by the OCX control on the "Dashboard Form"
  9. Application Hang

I'm confused about how the prior problem is live yet when i close the dashboard form and it cause new bigger problem when i reuse the ocx control.

Ramin Bateni
  • 16,499
  • 9
  • 69
  • 98

1 Answers1

0

Qv both OCX and web is often behaving strangely when it looses focus.

When using the OCX i use this

/// <summary>
    /// Loading the QV document and a retry when we have missed contact with the qv document.
    /// </summary>
    private void LoadQvIfNecessary(bool forceDocumentReload =false)
    {
        Parent.Text = DateTime.Now.ToLongTimeString();
        if (forceDocumentReload)
            axQlikMainApp.DocName = null;
        if (axQlikMainApp.ActiveDocument == null)
            axQlikMainApp.DocName = Loader.Instance.Settings.QlikViewPlanningDocumentPath;
            Thread.Sleep(100);
        if (axQlikMainApp.ActiveDocument == null)
        {
            DialogResult result = Logger.ShowMessage("Du har tappat kontakten med databasen.\nVill du återuppta kontakten med databasen?\nOm du väljer ”Avbryt” stängs programmet ned.","Tappat kontakt",Logger.MessageLevel.CriticalError,MessageBoxButtons.RetryCancel);
            if (result == DialogResult.Cancel)
                Environment.Exit(0);
            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(300);
                Application.DoEvents();
            }

            LoadQvIfNecessary();
        }
    }

It's an ugly bastard, but this actually works. The question is when you access this. I use the form focus event to check this out.

Also I have a manual button for reloading the document.

Archlight
  • 2,019
  • 2
  • 21
  • 34