Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get the value of an unbound combo box control

(0) ShareShare
ReportReport
Posted on by 692

Hi

I have extended a form and added an unbound combo box which has a new base enum as its enum type. How do I get the value of the combo box in the OnModified event handler? The sender variable which is of type FormControl doesn't seem to have a selection() method. Do I need to cast this to another type?

Thanks,
Joe

*This post is locked for comments

  • JoeBrewer Profile Picture
    692 on at
    RE: How to get the value of an unbound combo box control

    Thanks Martin. Much appreciated.

    Joe

  • Verified answer
    Martin Dráb Profile Picture
    234,595 Most Valuable Professional on at
    RE: How to get the value of an unbound combo box control

    You must realize that the event handler has the same signature for all types of controls, therefore sender is declared as something compatible with all controls (= their common parent class). But the value of you get has a concrete type, such as FormComboBoxControl, and you can cast sender to it to be able to access its methods.

    FormComboBoxControl combobox = sender as FormComboBoxControl;
    if (combobox)
    {
        ...
    }
  • JoeBrewer Profile Picture
    692 on at
    RE: How to get the value of an unbound combo box control

    Hi

    Here is the code I am using - the event handler has been copied from the combo box object on the form.

    [FormControlEventHandler(formControlStr(TransportationDocument, MyComboBox), FormControlEventType::Modified)]
        public void MyComboBox_OnModified(FormControl sender, FormControlEventArgs e) { }


    I just need to know what value has been selected when a user changes the value.

    Thanks,
    Joe

  • Chaitanya Golla Profile Picture
    17,225 on at
    RE: How to get the value of an unbound combo box control

    Hi,

    Could you please elaborate your requirement(or if I am missing something), as I don't think we cannot add eventhandler to the form control modified method.

    Thanks,

    Chaitanya Golla

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Kempeth Profile Picture

Kempeth 4

#1
Andy Adamak Profile Picture

Andy Adamak 4

#1
Community Member Profile Picture

Community Member 4

Featured topics

Product updates

Dynamics 365 release plans