Copy to clipboard

WAnsinWAnsin Member Posts: 6
edited 2002-07-30 in Navision Financials
Hello,
does anyone know how to export a textstring (including CR and LF) to the clipboard to paste this string in Word / Excel / AnyOtherProgram?

Actual I open a form wich displays the generated string and the user has to press CTRL-C (to copy). I want to send the string directly into the clipboardwithout this special form.

CR and LF are not the problem, this works fine.

Any ideas?

Best regards,
Wolfram

Comments

  • PrebenRasmussenPrebenRasmussen Member Posts: 137
    Explore the following functions in Visual Basic:

    Clipboard.Clear
    Clipboard.SetText CopyText

    They work just fine in i.e. an automation controller.
  • WAnsinWAnsin Member Posts: 6
    </font><blockquote><font size="1" face="Verdana, Arial">quote:</font><hr /><font size="2" face="Verdana, Arial">Originally posted by PrebenRasmussen:
    <strong>Explore the following functions in Visual Basic:

    Clipboard.Clear
    Clipboard.SetText CopyText

    They work just fine in i.e. an automation controller.</strong></font><hr /></blockquote><font size="2" face="Verdana, Arial">Thank you. But wich automation controller? I searched many, but didn't find the functions you said above.

    I don't have VB. And I want to use this function at every Client. Do I need a VB runtime?

    Best regards,
    Wolfram
  • mappymappy Member Posts: 4
    Hi

    I have made a very simple ActiveX control, that you can include from within Navision. I could upload it to this site, or I could E-mail it to you.

    Do you want it, or have you already solved the problem yourself?

    Regards
    Michael
  • WAnsinWAnsin Member Posts: 6
    Dear Michael,

    please post it to the board. I think I am not the only one who would like a function like this.

    If you don't have a manual or codesample ..., after I checked the ActiveX I will write it and send to you.

    Thank you very much.

    Best regards,
    Wolfram
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Concerning the installation of ActiveX-controls on every client: why not import the OCX in a BLOB-field in the Navision database? You can check in Navision if the particular OCX is installed on the client computer, by checking the virtual table OLE Control. If it is not installed, you can export the OCX to the Windows system directory, and register this component using regsvr32.exe.

    Just an idea.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • WAnsinWAnsin Member Posts: 6
    Sorry about my following questions:

    - how can I import a OCX in a BLOB (I never tried it and didn't make any experiments, and actually have no idea how to do this)

    - how can I check if a special OCX is installed before execution of a OCX?
    (e.g. in a Report/Codeunit ... I have a global automation contoller defined. Now if I start the Codeunit I get a error message if the OCX is not installed; I have no chance to check the OCX)

    - how can I export the OCX to the system and register it; since today I never ran external programs.

    Maybe these are beginner questions, but how to check a OCX also a solution center didn't know.

    Best regards,
    Wolfram
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    To import a file into a blob:
    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">
    txtPath := 'd:\path\myocx.ocx';

    recCompanyInfo.GET;
    recCompanyInfo."OCX Component".IMPORT(txtPath,TRUE);
    recCompanyInfo.MODIFY;</pre><hr /></blockquote><font size="2" face="Verdana, Arial">This example presumes you have created a blob-field "OCX Component" in table 79 Company Information.

    To check if OCX is installed:
    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">recOLEControl.SETRANGE(Name,'myOCX name');
    recOLEControl.SETRANGE(Version,'1.0');
    IF NOT(recOLEControl.FIND('-')) THEN
    MESSAGE('OCX is not installed yet');</pre><hr /></blockquote><font size="2" face="Verdana, Arial">This example presumes you have created a record variable recOLEControl with Subtype "OLE Control".

    To register the OCX on the client:
    </font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">recCompanyInfo.CALCFIELDS("OCX Component");
    IF recCompanyInfo."OCX Component".HASVALUE THEN BEGIN
    recCompanyInfo."OCX Component".EXPORT('myocx.ocx',FALSE);
    intReturnValue := SHELL('regsvr32.exe','myocx.ocx');
    END;</pre><hr /></blockquote><font size="2" face="Verdana, Arial">This code has not been tested, but this shows you the way.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • mappymappy Member Posts: 4
    Hi

    I'm just about to upload the clipboard ocx. I'm currently writing some sample code for demonstration purpose. It will be uploaded sometime today.

    Regards
    Michael
  • mappymappy Member Posts: 4
    Hi

    I've just uploaded the clipboard ocx, so it should be available within the next couple of days.

    Regards
    Michael
  • WAnsinWAnsin Member Posts: 6
    Dear Michael, dear Luc,

    thank you very much to both of you.

    <img border="0" title="" alt="[Smile]" src="images/smiles/icon_smile.gif" /> Michael, I just loaded your OCX, and it works really fine, just the way I was looking for. Thank you very much.

    <img border="0" title="" alt="[Smile]" src="images/smiles/icon_smile.gif" /> Luc, your idea to import an OCX in the database, to export it and to register it works fine (in my test-environment: Win98SE, Navision 2.60). You can combine the check and the installation.
    To compile the code the OCX must be registered!
    Also thank you very much to you.

    You both are really great guys.

    Best regards,
    very happy Wolfram <img border="0" title="" alt="[Big Grin]" src="images/smiles/icon_biggrin.gif" />
Sign In or Register to comment.