Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 493581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:25:10+00:00 2026-05-13T05:25:10+00:00

Actually I would need 4 methodes. I’m using c# .NET 3.5 and windows forms.

  • 0

Actually I would need 4 methodes. I’m using c# .NET 3.5 and windows forms.

  1. Get ALL control properties (also sub properites like MenuItems etc.) from current form where name matches list name //don’t works ok
  2. Save results to XML //don’t know how to save the results
  3. Load result from XML and
  4. finally set loaded control properties from XML. //work great

Now I’m doing this form step 1:

  public static Dictionary<string, object> xmlDictionary;
  public Control FindControlRecursive(Control container, List<string> properties)
  {
     foreach (Control controls in container.Controls)
     {
        Type controlType = controls.GetType();
        PropertyInfo[] propertyInfos = controlType.GetProperties();
        foreach (PropertyInfo controlProperty in propertyInfos)
        {
           foreach (string propertyName in properties)
           {
              if (controlProperty.Name == propertyName)
              {
                 xmlDictionary.Add(controlProperty.Name, controlProperty.GetValue(controls, null));
              }
           }
        }
        Control foundCtrl = FindControlRecursive(controls, properties);
        if (foundCtrl != null)
           return foundCtrl;

     }
     return null;
  }

Calling the metod:

     List<string> propertyNames = new List<string>(); //list of all property names I want to save

     propertyNames.Add("Name");
     propertyNames.Add("Text");
     propertyNames.Add("Size");

     FindControlRecursive(this, propertyNames); //this is the current form

This method doesn’t return all control properties and I dont know why.

Step 4.:

//field = some new field
//newValue = new value
    FieldInfo controlField = form.GetType().GetField(field, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
    object control = controlField.GetValue(form);
    PropertyInfo property = control.GetType().GetProperty(newValue);
    property.SetValue(control, items.Value, new object[0]);

Step 4 work great, but don’t know how to iterate through XML reults.

Could you please help me to solve these problems.

Thank and best regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:25:10+00:00Added an answer on May 13, 2026 at 5:25 am

    Are you aware that with Windows Forms there is an existing settings infrastructure you can use to save settings of controls and your forms? From the designer, select a control and in the properties under Application Settings, then Property Binding, you can bind any property on the control to a property that will be generated to access and save that property value. The settings can be application or user scoped. These settings will also use isolated storage, allow you to upgrade to different versions of settings to maintain user settings between versions, and many other features. So this may not directly answer your question, but may be a better solution for your particular problem. Once you bind a property you can save changes whenever you want, on a per user or per application basis like so:

    Settings.Default.TextBox1 = textBox2.Text;
    Settings.Default.BackColor = Color.Blue;
    Settings.Default.Save();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 269k
  • Answers 269k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As in...UI output? You might want to be more specific… May 13, 2026 at 1:20 pm
  • Editorial Team
    Editorial Team added an answer ASP.NET MVC has the following property on it's Request object:… May 13, 2026 at 1:20 pm
  • Editorial Team
    Editorial Team added an answer You use variable_get for accessing a value previously set with… May 13, 2026 at 1:20 pm

Related Questions

Actually I would need 4 methodes. I'm using c# .NET 3.5 and windows forms.
The goal is to run some tests given some data in those Xml files.
I currently have an application that gets hit with over 20,000 users daily and
I'm building a game server in Python and I just wanted to get some
I have been developing using a single 15.4 laptop for a while (duh!). Actually

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.