Click here to Skip to main content
15,923,087 members
Home / Discussions / C#
   

C#

 
Generalsystem.web.mail question Pin
ekuhner8-Apr-03 6:00
ekuhner8-Apr-03 6:00 
GeneralRe: system.web.mail question Pin
Jody Bell8-Apr-03 9:28
Jody Bell8-Apr-03 9:28 
GeneralRe: system.web.mail question Pin
Leon van Wyk10-Apr-03 2:09
professionalLeon van Wyk10-Apr-03 2:09 
GeneralFormating the xml-output from a DataSet Pin
Knappen8-Apr-03 5:33
Knappen8-Apr-03 5:33 
GeneralRe: Formating the xml-output from a DataSet Pin
Le centriste8-Apr-03 6:11
Le centriste8-Apr-03 6:11 
GeneralRe: Formating the xml-output from a DataSet Pin
Bruce Duncan9-Apr-03 1:19
Bruce Duncan9-Apr-03 1:19 
GeneralRe: Formating the xml-output from a DataSet Pin
Knappen9-Apr-03 3:36
Knappen9-Apr-03 3:36 
GeneralListBox and DataSource Pin
mkomasi8-Apr-03 4:52
mkomasi8-Apr-03 4:52 
Hi,

I have two lists (A and B).I want to add some items from A to B and remove the items from A. I've used two ListBoxes for this situation.

I want to display Name of items and for adding and removing I have to know ID of each item. So I use ListBox.DataSource to fill items. First I define a class:
<br />
	public class USState<br />
	{<br />
		private string myShortName ;<br />
		private string myLongName ;<br />
   <br />
		public  USState(string strLongName, string strShortName)<br />
		{<br />
<br />
			this.myShortName = strShortName;<br />
			this.myLongName = strLongName;<br />
		}<br />
<br />
		public string ShortName<br />
		{<br />
			get<br />
			{<br />
				return myShortName;<br />
			}<br />
		}<br />
<br />
		public string LongName<br />
		{<br />
      <br />
			get<br />
			{<br />
				return myLongName ;<br />
			}<br />
		}<br />
<br />
		public override string ToString()<br />
		{<br />
			return this.ShortName + " - " + this.LongName;<br />
		}<br />
	}<br />


Then for filling list items :
<br />
	ArrayList USStatesA = new ArrayList()   ;<br />
	ArrayList USStatesB = new ArrayList()   ;<br />
	USStatesA.Add(new USState("Alabama", "AL"));<br />
	USStatesA.Add(new USState("Washington", "WA"))  ; <br />
	USStatesA.Add(new USState("West Virginia", "WV"));<br />
	USStatesA.Add(new USState("Wisconsin", "WI")) ;<br />
	USStatesB.Add(new USState("Wyoming", "WY"));<br />
<br />
	ListBoxA.DisplayMember = "LongName"     ;<br />
	ListBoxA.ValueMember = "ShortName" ;<br />
	ListBoxA.DataSource = USStatesA ;<br />
<br />
	ListBoxB.DisplayMember = "LongName"     ;<br />
	ListBoxB.ValueMember = "ShortName" ;<br />
	ListBoxB.DataSource = USStatesB ;<br />

Everything is OK by above codes. But the problem is: When I Remove an object from ListBoxA and then Add it to ListBoxB; no changes will be appear in ListBoxA.Items or ListBoxB.Items .

How can I update ListBox Items same as its DataSource updated?

regards,
Mehdi
GeneralRe: ListBox and DataSource Pin
Chris Jobson8-Apr-03 8:24
Chris Jobson8-Apr-03 8:24 
GeneralRe: ListBox and DataSource Pin
mkomasi8-Apr-03 19:12
mkomasi8-Apr-03 19:12 
GeneralRe: ListBox and DataSource Pin
Chris Jobson9-Apr-03 8:03
Chris Jobson9-Apr-03 8:03 
GeneralAdding a progressbar to a statusbar Pin
monrobot138-Apr-03 4:50
monrobot138-Apr-03 4:50 
GeneralRe: Adding a progressbar to a statusbar Pin
Chris Austin8-Apr-03 5:37
Chris Austin8-Apr-03 5:37 
GeneralRe: Adding a progressbar to a statusbar Pin
monrobot138-Apr-03 6:42
monrobot138-Apr-03 6:42 
GeneralRe: Adding a progressbar to a statusbar Pin
Thomas Freudenberg8-Apr-03 13:55
Thomas Freudenberg8-Apr-03 13:55 
GeneralRe: Adding a progressbar to a statusbar Pin
Thomas Freudenberg8-Apr-03 13:58
Thomas Freudenberg8-Apr-03 13:58 
QuestionGetLocaleInfo for .NET? Pin
Alvaro Mendez8-Apr-03 4:46
Alvaro Mendez8-Apr-03 4:46 
AnswerRe: GetLocaleInfo for .NET? Pin
Chris Jobson8-Apr-03 8:33
Chris Jobson8-Apr-03 8:33 
GeneralRe: GetLocaleInfo for .NET? Pin
Alvaro Mendez8-Apr-03 9:15
Alvaro Mendez8-Apr-03 9:15 
GeneralCustomize a Column Header of a Windows Form DataGrid Pin
mcolucci8-Apr-03 4:35
mcolucci8-Apr-03 4:35 
GeneralDataBase > Need the Amount of records in a database Pin
Leon van Wyk8-Apr-03 3:20
professionalLeon van Wyk8-Apr-03 3:20 
GeneralRe: DataBase > Need the Amount of records in a database Pin
Catherder8-Apr-03 4:02
Catherder8-Apr-03 4:02 
GeneralJ# Not C# Pin
oggychristie8-Apr-03 2:16
oggychristie8-Apr-03 2:16 
GeneralRe: J# Not C# Pin
Katalyst8-Apr-03 5:31
Katalyst8-Apr-03 5:31 
GeneralMirroring Explorer Functionality Pin
MrEyes8-Apr-03 1:24
MrEyes8-Apr-03 1:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.