Search code examples
c#.netstringqlikviewcomobject

How to convert System.__ComObject to a string?


case 6: //text
    QVObject.GetSheet().Activate();
    ReportControl.QVApp.WaitForIdle();
    if (objectName == "TX01")
    {
        Console.WriteLine("I have found my fullname again");
        //tamp_val = QVObject.CopyTextToClipboard(); // copy text field in global object tamp_val

        Console.WriteLine("GetRelevantSelection my object type" + QVObject.GetRelevantSelections());

        Console.WriteLine("The type of my object is :" + QVObject.GetType());
    }

QVObject.GetType() returns a System.__ComObject. How to save this result as a string?


Solution

  • (From the comments)

    Calling QVObject.CopyTextToClipboard(); get the text from the object to the clipboard, which can then be retrieved by calling Clipboard.GetText();.

    The downside of this is that it destroys what was on the clipboard before your code ran. But it at least uses QlikView's existing text retrieval to get the contents of the object.