---
title: "Transferring data from one list box to another c#"  
description: "Transferring data from one list box to another c#"  
author: "Anonymous User"  
published: 2013-12-12  
updated: 2013-12-12  
canonical: https://www.mindstick.com/forum/1769/transferring-data-from-one-list-box-to-another-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Transferring data from one list box to another c#

I have 2 list boxes one is [connected](https://www.mindstick.com/articles/12941/link-building-and-search-engine-rankings-how-are-they-connected) to a [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) the other isnt.

I want to be able to send the selected [item](https://www.mindstick.com/forum/156564/remove-item-in-an-array-in-javascript) from the [listbox](https://www.mindstick.com/articles/626/listbox-events-in-c-dot-net) connected to the database to the one that isnt.

Ive written this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)

listBox2.Items.Add(listBox1.SelectedItem);

But [instead of](https://www.mindstick.com/articles/330/triggers-in-sql-server) copyin the item i get "

System.Data.DataRowView

[Anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) having any [advice](https://yourviews.mindstick.com/view/50528/filament-advice-5-things-to-consider-before-you-buy-a-filament)?

## Replies

### Reply by Pravesh Singh

Hi Jeet,\
\

This is the simplest way to load a listbox to another list box and at the same time remove the data from the sorce listbox

```
int mCount = ListBox1.Items.Count;for (int i = 0; i <= mCount - 1; i++){    if
(ListBox1.Items[i] == ListBox1.SelectedItem)    {       
ListBox2.Items.Add(ListBox1.SelectedItem);       
ListBox1.Items.Remove(ListBox1.SelectedItem);        mCount=mCount
- 1;        i=i - 1;    }}
```


---

Original Source: https://www.mindstick.com/forum/1769/transferring-data-from-one-list-box-to-another-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
