Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

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

(0) ShareShare
ReportReport
Posted on by

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
    944 on at
    RE: Problem with retrieving data from C# .NET .DLL in NAV

    Send it to abeywicrema@gmail.com

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

    Sure, where can I send you my dll?

  • ShanAbeywicrema Profile Picture
    944 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
    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
    944 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
    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
    944 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
    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
    944 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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics NAV (Archived)

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans