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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:32:17+00:00 2026-06-10T12:32:17+00:00

I have a listBox1 with 4 items inside. I can use the keys to

  • 0

I have a listBox1 with 4 items inside. I can use the keys to move up-down between the items or click with the mouse once on each item in both cases the selected items will be highlight with blue marked .

I want when I click on an item or when I move the keys up and down over the items it will change the label.Text with the current item name.

For example in on the item moses so label1.Text will contain moses.
Moved to the next item with arrow key up so now label1.Text contain daniel.
Clicked with the mouse on the item number 3 now label1.Text will contain dana.

Tried with this:

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                //listBox1.Items.Add(fsi[i].Name + Environment.NewLine);
                label2.Text = listBox1.Items[i].ToString();
            }
        }

But its not worrking.

  • 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-10T12:32:18+00:00Added an answer on June 10, 2026 at 12:32 pm

    Works for me.

    private void Form1_Load(object sender, EventArgs e)
    {
       listBox1.Items.Add("Item1");
       listBox1.Items.Add("Item2");
       listBox1.Items.Add("Item3");
       listBox1.Items.Add("Item4");
     }
    
    private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
       label1.Text = listBox1.SelectedItem.ToString();   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListBox in Silverlight that has a list of items inside. Each
Basically I'm dynamically adding items to a listbox. Inside of each listbox item I
I have a listbox representing a SQL WHERE statement and the items inside can
I have a WPF listbox with custom items. Each item is a user control
well i have a listbox with some items inside. i want to detect a
So I have this Xaml inside a ListBox Item Template: <ListBox.ItemTemplate> <DataTemplate> <Grid Height=22
I want to create the content of the each item inside a ListBox dynamically
I have two ListBoxes, one inside another. And both ListBoxes will have items dynamically
listbox1.items[0].tostring(); its the command for getting the text value of item at 0th index
I have listBox1 but when I am using that listBox1 inside the buttonClick I

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.