Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Problem with retrieving data from C# .NET .DLL in NAV

Posted on by Microsoft Employee

Hi everyone,

I prepared c# code where I added some data and i want to get this data in NAV. 

Everything is ok, when I only display this data in C# code (for example with MessageBox.Show), but when i'm trying to get this in C/AL (MESSAGE(data)) - something is wrong, because it does not work.

This is Control Add IN, so i added field on the page with this AddIn, and i'm trying to enter the c/al code in ControlAddIn trigger.

What is wrong? 

Code on this screen below:

DnD.png

DnD = DotNet Variable with my AddIn .dll.

Drag a File And Drop - field on the page with ControlAddInProperty - add in name + add in public token.

How can I get any datas from my dotnet dll? I need this, because I have to add some information about drag and drop files to nav tables.

Code which I want to have in NAV.

public void picbox_dnd(Object sender, DragEventArgs e)
        {

            string[] filecollection = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string file in filecollection)
            {
                data = Path.GetFullPath(file);
                MessageBox.Show(data);
            }

        }


Thanks for any ideas!

*This post is locked for comments

  • ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    Send it to abeywicrema@gmail.com

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    Sure, where can I send you my dll?

  • ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    Can you share you dll if you do not mind. I will try locally and tell you what exactly you want to do.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    Thanks, but for example: " this.RaiseControlAddInEvent(index, data);" does not work in new versions of NAV.

    I read this article and I don't find solution for my issue.

    Do you want maybe another ideas?

  • ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    May be this will help you

    [View:https://msdn.microsoft.com/en-us/library/dd983804(v=nav.90).aspx:750:50]

    As per the example you do not want to write code if you have properly set all the required things.

    If my answer make you to resolve your problem, please verify it by clicking Yes 

    Regards

    Shan Abeywickrema

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    I only need to retrieve  path of the dropped file from this DLL and add it as a text variable. Later I will use this data to upload files to BLOB.

    It's not important for me, where can I get any data from this dll, but I want to do it somewhere.

  • ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    That means when you try this alone with code unit. it works for you ? You need this on Page OnControlAddin trigger ?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    Thanks for your reply.

    I know, how to call this function, but OnControlAddIn trigger does not work.

    When i am trying to do something in this trigger, (i.e. C/AL MESSAGE('x')_ and when I'm running my page this code is not displaying. I want to use this trigger, but I can't.

  • ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    // As I guess this would be your Constructor Call

    Dnd := Dnd.DroGDrop;

    Then you need to call your method Dnd.picbox_dnd right with sending proper parameters.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans