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

  • Home
  • SEARCH
  • 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 6536739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:31:48+00:00 2026-05-25T10:31:48+00:00

I have two listbox in windows Form c#, the first one has all valid

  • 0

I have two listbox in windows Form c#, the first one has all valid rooms at this time & the 2nd has the current rooms reserved to the Guest, & the user can change this data by transfer between this listboxex.

as example:

list1: 1d ,5d ,6d , 1r, 12r

list2: 2d, 4d

the user can delete 2d and put instead of it 6d.

what I need how can I read all data from list2 after user update it, & use this to update my table in sql server.

  • 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-25T10:31:49+00:00Added an answer on May 25, 2026 at 10:31 am

    To copy a selected item from one list box to another you could use the following code. Ensure that the SelectionMode for the listbox is Single. This bit of code reads the selected item, adds it to the other ListBox and removes it from the current ListBox. You do not need to cast it to a string as there is no reason to read the actual data. This also allows you to have complex objects as listBoxItems.

    object obj = listBox1.SelectedItem;
    listBox2.Items.Add(obj);
    listBox1.Items.Remove(obj);
    

    If you link this to left/right buttons, you can ensure that the user is not able to duplicate rooms or add room numbers which are outside the scope.

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

Sidebar

Related Questions

My scenario is this: I have two listbox's, one that contains all my database
Let's say I have a listbox and two buttons in a windows form application.
I have two XAML pages. One page (named Page1) has a listbox named strangers
I have two classes A & B, and a listbox. I assign listBox.ItemsSource equal
I have a Windows Form and a class with two simple methods that run
I've got a Windows Forms application with two ListBox controls on the same form.
I have a Windows Form with two list boxes on it. Also there is
I Have two listboxes when I drag One item from the source listbox I
I have two ListBoxes, lstAvailableColors and lstSelectedColors. Between each listbox are two buttons, Add
I have an instance of ObservableCollection bound to a WPF listbox with two separate

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.