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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:26:02+00:00 2026-05-15T08:26:02+00:00

In C# WinApp, how can I add both Text and Value to the items

  • 0

In C# WinApp, how can I add both Text and Value to the items of my ComboBox?
I did a search and usually the answers are using “Binding to a source”.. but in my case I do not have a binding source ready in my program…
How can I do something like this:

combo1.Item[1] = "DisplayText";
combo1.Item[1].Value = "useful Value"
  • 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-15T08:26:03+00:00Added an answer on May 15, 2026 at 8:26 am

    You must create your own class type and override the ToString() method to return the text you want. Here is a simple example of a class you can use:

    public class ComboboxItem
    {
        public string Text { get; set; }
        public object Value { get; set; }
    
        public override string ToString()
        {
            return Text;
        }
    }
    

    The following is a simple example of its usage:

    private void Test()
    {
        ComboboxItem item = new ComboboxItem();
        item.Text = "Item text1";
        item.Value = 12;
    
        comboBox1.Items.Add(item);
    
        comboBox1.SelectedIndex = 0;
    
        MessageBox.Show((comboBox1.SelectedItem as ComboboxItem).Value.ToString());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

C# WinApp: Let's say I search for dtg but the items that I am
How to detect IIS version using C#? Update: I meant from a winapp (actually
I am trying to write something for windows using WINAPI, so I can make
After happily using open source software for many years I've figured it's time to
Using a WinApp form in c#, and many buttons here... I want to create
I would retrive the Return value from a function php to a C# WinApp
I'm using Add-in-Express to develop a prototype of our plugin for Outlook and what
We can set window text with: BOOL WINAPI SetWindowText( __in HWND hWnd, __in_opt LPCTSTR
I can access a method from a C++ Dll using C# using this method
When we use WindowFromPoint winapi function we usually can get the case, when Point

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.