web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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

I have the same question (0)
  • Chaitanya Golla Profile Picture
    17,225 on at

    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

  • JoeBrewer Profile Picture
    692 on at

    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

  • Verified answer
    Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at

    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

    Thanks Martin. Much appreciated.

    Joe

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 34

#1
CP04-islander Profile Picture

CP04-islander 34

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans