© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
Cliff Karlsson

❔ How to access variable from AccessibilityObject ?

I am trying to make canges to an old Winforms or Window forms application and my main goal is to populate a dropdown-menu with some values.

internal class OrderdocumentValuePickerEditor : UITypeEditor
    {
        
        IWindowsFormsEditorService m_editorService;

        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.DropDown;
        }

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            m_editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            Form f = Application.OpenForms["LabelmakerDesignForm"];
            
internal class OrderdocumentValuePickerEditor : UITypeEditor
    {
        
        IWindowsFormsEditorService m_editorService;

        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.DropDown;
        }

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            m_editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            Form f = Application.OpenForms["LabelmakerDesignForm"];
            

The EditValue function is called when I click on the dropdown and I am trying to access a public variable called m_orderdoc.
If I search for a value in the orderdoc in the "locals" part of Visual studio I see that the m_orderdoc is located in:
provider.AccessibilityObject -> PropertyGridView -> TopLevelControl -> m_orderdoc
provider.AccessibilityObject -> PropertyGridView -> TopLevelControl -> m_orderdoc

But how can I access this value?
I also tried using
Application.OpenForms
Application.OpenForms
to get a form that contains the variable. But I can't access it from there either even tho I see that
f
f
contains m_orderdoc.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How to access variable from another class?
C#CC# / help
3y ago
❔ ✅ Access variable from another script
C#CC# / help
3y ago
❔ c# access variable from other thread
C#CC# / help
3y ago
✅ Variable access help :(
C#CC# / help
2y ago