Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collection as DataSource in ListBox
Message
De
28/02/2005 10:21:35
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00990658
Message ID:
00991180
Vues:
18
Very strange Einar. I copied your class and collection code into my test form. It worked fine. I'm not sure where else to look.

~~Bonnie


>Bonnie,
>I still can not get it to "refresh" even when setting the SataSource to null and then setting it back to my collection. I can see through the debugger that the values in the collection has changed. Something even more strange happend once I made the code change, the selected index in the listbox does not appear to change, i.e. the blue hightlighted row does not change, but the selectedindexchanged even fires. Very odd. I am starting to think that I might use a datatable instead <s>, but before I do I would still like to figure this out.
>Below is the code for the class and for the collection class. Please feel free to comment on both.
>
>
>using System;
>
>namespace ALS.ImageviewConfig
>{
>	/// <summary>
>	/// Summary description for IndividualDelay.
>	/// </summary>
>	public class IndividualDelay
>	{
>		#region Properties
>		private System.Int16 _IncludeFile;
>		public	System.Int16 IncludeFile
>		{
>			get
>			{
>				return this._IncludeFile;
>			}
>			set
>			{
>				this._IncludeFile = value;
>			}
>		}
>
>		private System.Int16 _IncludeDelay;
>		public	System.Int16 IncludeDelay
>		{
>			get
>			{
>				return this._IncludeDelay;
>			}
>			set
>			{
>				this._IncludeDelay = value;
>			}
>		}
>
>
>		#endregion Properties
>
>		#region Constructor
>		public IndividualDelay(System.Int16 paraIncludeFile, System.Int16 paraIncludeDelay)
>		{
>			this.IncludeFile = paraIncludeFile;
>			this.IncludeDelay = paraIncludeDelay;
>		}
>		#endregion Constructor
>
>
>		#region Override
>
>		public override string ToString()
>		{
>			return "Include"+this.IncludeFile.ToString().PadRight(15,' ') + "Delay:" + this.IncludeDelay.ToString().PadLeft(4,' ');
>		}
>
>
>		#endregion Override
>
>
>
>	}
>}
>
>
>
>
>using System;
>using System.Collections;
>
>using ALS.ImageviewConfig;
>
>
>namespace ALS.ImageviewConfig
>{
>	/// <summary>
>	/// Summary description for IndividualDelayCollection.
>	/// </summary>
>	public class IndividualDelayCollection : CollectionBase
>	{
>
>		public IndividualDelay this[ int index ]
>		{
>			get
>			{
>				return( (IndividualDelay) List[index] );
>			}
>			set
>			{
>				List[index] = value;
>			}
>		}
>
>		public int Add( IndividualDelay value )
>		{
>			return( List.Add( value ) );
>		}
>
>		/*
>		public int IndexOf( Int16 value )
>		{
>			return( List.IndexOf( value ) );
>		}
>		*/
>
>		public void Insert( int index, IndividualDelay value )
>		{
>			List.Insert( index, value );
>		}
>
>		public void Remove( Int16 value )
>		{
>			List.Remove( value );
>		}
>		/*
>				public bool Contains( Int16 value )
>				{
>					// If value is not of type Int16, this will return false.
>					return( List.Contains( value ) );
>				}
>		*/
>		protected override void OnInsert( int index, Object value )
>		{
>			if ( value.GetType() != Type.GetType("ALS.ImageviewConfig.IndividualDelay") )
>				throw new ArgumentException( "Value must be of type ALS.ImageviewConfig.IndividualDelay.", "value" );
>		}
>
>		protected override void OnRemove( int index, Object value )
>		{
>			if ( value.GetType() != Type.GetType("ALS.ImageviewConfig.IndividualDelay") )
>				throw new ArgumentException( "Value must be of type ALS.ImageviewConfig.IndividualDelay.", "value" );
>		}
>
>		protected override void OnSet( int index, Object oldValue, Object newValue )
>		{
>			if ( newValue.GetType() != Type.GetType("ALS.ImageviewConfig.IndividualDelay") )
>				throw new ArgumentException( "newValue must be of type ALS.ImageviewConfig.IndividualDelay.", "newValue" );
>		}
>
>		protected override void OnValidate( Object value )
>		{
>			if ( value.GetType() != Type.GetType("ALS.ImageviewConfig.IndividualDelay") )
>				throw new ArgumentException( "value must be of type ALS.ImageviewConfig.IndividualDelay." );
>		}
>
>	}
>
>
>
>}
>
>
>I am beginning to thisnk there is something wrong with my collection class
>
>Thanks,
>Einar
>
>
>>Einar,
>>
>>>You seem to like the datatable a lot <s><
>>
>>LOL!! As a matter of fact, I do. <s>
>>
>>>I thought I tried setting the datasource to null and then setting it back to the collection and it did not work for me. I will have to test that again later tonight.<
>>
>>Well, if that doesn't work, then something else is going on ... it worked for me with a very simple Collection.
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform