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 9163291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:24:42+00:00 2026-06-17T14:24:42+00:00

As it stands I’m using a Dictionary to store answers to a question in

  • 0

As it stands I’m using a Dictionary to store answers to a question in the following format:-

Destination:
A1 - Warehouse
A2 - Front Office
A3 - Developer Office
A4 - Admin Office
B1 - Support

A1, A2 etc are unique identifiers used to select questions elsewhere and the answer is tagged on at the end, the dictionary stores ID and the Answer.

This part all works fine. The problem is when inserting the data into a list box/combo box. At the moment I’m using the method below:

foreach (KeyValuePair<string, string> oTemp in aoObjectArray)
{
    if (listControl is ComboBox)
    {
        ((ComboBox)listControl).Items.Add(string.Format("{0} - {1}", 
                                          oTemp.Key, oTemp.Value));
    }
    else if (listControl is ListBox)
    {
        ((ListBox)listControl).Items.Add(string.Format("{0} - {1}",
                                         oTemp.Key, oTemp.Value));
    }
}

This inserts the correct data into the list/combo box but in the following format:

Destination:
[A1: Warehouse]
[A2: Front Office]
[A3: Developer Office]
[A4: Admin Office]
[B1: Support]

I’ve tried a number of other methods to get rid of the squared brackets. Interestingly if I
just do

((ComboBox)listControl).Items.Add(string.Format(oTemp.Value));

I still get the data out in the [A1: Warehouse] format. How can I get rid of the squared brackets?

EDIT: Been asked to add more code. Here is the full add to list control method:

public static void AddDictionaryToListControl(ListControl listControl,
                              Dictionary<string, string> aoObjectArray)
    {
        foreach (KeyValuePair<string, string> oTemp in aoObjectArray)
        {
            if (listControl is ComboBox)
            {
                ((ComboBox)listControl).Items.Add(string.Format(oTemp.Value));
            }
            else if (listControl is ListBox)
            {
                ((ListBox)listControl).Items.Add(string.Format(oTemp.Value));
            }
        }
    }

This method is called from:

    public ComboBox AddQuestionsComboBox(Dictionary<string, string> Items,
                       string Label, string Key, int Order, bool Mandatory)
    {
        ComboBox output; 

        output = AddControl<ComboBox>(Label, Key, Order);
        FormsTools.AddDictionaryToListControl(output, Items);
        AddTagField(output, Tags.Mandatory, Mandatory);

        return output;
    }

Which is called using the following line:

AddQuestionsComboBox(question.PickList, question.PromptTitle, question.FieldTag, 
i, offquest.Mandatory);

Hope that helps.

EDIT: I’ve tried all the suggestions below and still no improvement – I’ve checked and rechecked the code and all methods that relate to it for some additional formatting I’ve missed and found nothing that could cause the formatting to be set correctly at one stage and then binned by the time it gets on screen.

  • 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-06-17T14:24:44+00:00Added an answer on June 17, 2026 at 2:24 pm

    I can’t see there is a problem.

    var aoObjectArray = new Dictionary<string, string>();
    aoObjectArray["A1"] = "Warehouse";
    aoObjectArray["A2"] = "Front Office";
    aoObjectArray["A3"] = "Developer Office";
    
    foreach (KeyValuePair<string, string> oTemp in aoObjectArray)
    {
        ((ComboBox)listControl).Items.Add(string.Format("{0} - {1}", oTemp.Key, oTemp.Value));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In maven, what does -e stands for in the following command. mvn -e clean
I have the following code: @profile.update_attributes(params[:xxxx_profile]) where xxxx stands for either male or female.
What does the following problem in NetBeans 6.1 IDE stands for while working in
As it stands i have created a navigation menu using the background-position css property.
As it stands now, I'm a Java and C# developer. The more and more
I have been looking around and following each tutorials,there is one which stands out.
JSON stands for JavaScript Object Notation. But how come languages like php, java, c
As it stands, I have a deserialiser that can import any model I throw
As it stands now, you can't reopen Engine classes contained within the engine's /app
I know what AJAX stands for. I know javascript passably well. But frankly I'm

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.