Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP forum
Suggested answer

How can I get value of TreeView selected Node in VBA?

Posted on by 45

Hi,

I am trying to get value of selected node of TreeView in VBA on Select In-Transit Items window. 

I have added TreeView control field in VBA and when I tried to get Value, It always returns empty. How can I get that selected value?

See below screenshot.

pastedimage1648137955530v2.png

Thanks,

Atul

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,837 Moderator on at
    RE: How can I get value of TreeView selected Node in VBA?

    The following example shows how you can call Dexterity SanScript code from VBA

    winthropdc.wordpress.com/.../

    Here is some example code:

    local long node_ID;

    local string node_label;

    {Get the ID of the selected node.}

    node_ID = TreeView_GetSelectedNode('TreeView' of window WindowName of form FormName);

    if node_ID <> TV_NODEINVALID then

       {Get the node label.}

       node_label = TreeView_GetNodeLabel('TreeView' of window WindowName of form FormName, node_ID);

    else

       warning "No item is selected in the Address List field.";

    end if;

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,837 Moderator on at
    RE: How can I get value of TreeView selected Node in VBA?

    Hi Autel

    The only method that will work from VBA is pass through sanScript and using the Dexterity commands.

    I would recommend that you move away from VBA which is "End of Life" and does not work on the web client and Windows Servers.

    Instead you should look to the alternatives, Dexterity, Visual Studio Tools or better still GP Power Tools which is a perfect replacement for VBA as well as offering many other must have features.

    See: https://winthropdc.wordpress.com/2019/08/12/gppt-replacing-vba-with-gp-power-tools-developer-tools/

    Also see the Benefits Presentation: https://www.winthropdc.com/ftp/pub/GPPowerTools_Benefits.ppsx

    David

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Product updates

Dynamics 365 release plans