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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:07:53+00:00 2026-06-09T09:07:53+00:00

I have a dictionary with several items in it: public static Dictionary<string, string> vmDictionary

  • 0

I have a dictionary with several items in it:

public static Dictionary<string, string> vmDictionary = new Dictionary<string, string>();

And I have a method to add the items from within it to a listbox:

        foreach (KeyValuePair<String, String> entry in MyApp.vmDictionary)
        {
            ListViewItem item = new ListViewItem();
            item.SubItems.Add(entry.Value[0]);
            item.SubItems.Add(entry.Value[1]);
            selectVMListView.Items.Add(

}

Although I get the following error:

Error 2 Argument 1: cannot convert from ‘char’ to ‘string’

Relating to these lines:

            item.SubItems.Add(entry.Value[0]);
            item.SubItems.Add(entry.Value[1]);

entry.Value[0] and [1] should be string if I am not mistaken, but for some reason its complaining they are chars :S

  • 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-09T09:07:57+00:00Added an answer on June 9, 2026 at 9:07 am

    entry.Value returns the value component of the KeyValuePair<,>, which in this case is a string, when you then use an index on this string, you are getting a char. I think what you mean to have is the following:

    item.SubItems.Add(entry.Key);
    item.SubItems.Add(entry.Value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dictionary public static IDictionary<string, IList<string>> checksCollection = new Dictionary<string, IList<string>>(); I
I have dictionary, like Dictionary<string, bool> accValues = new Dictionary<string, bool>() And I want
I have several TSV files ranging in size from 2MB to 450MB. I need
I have several layers of function calls, passing around a common dictionary of key
We have a v.large Dictionary<long,uint> (several million entries) as part of a high performance
I have an NSArray with several NSDictionaries . I want to create a new
I have the following code: private Dictionary<int, Entity> m_allEntities; private Dictionary<Entity, List<IComponent>> m_entityComponents; public
Suppose I have a Dictionary<string, string> instance, like this one: { { a, 1
I have like 300000 words in my dictionary (actually saved in txt format (new
I have several classes that are derived from SPPersistedObject. One of them is my

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.