PC Review


Reply
Thread Tools Rate Thread

changing the behaviour of setting the DataSource property

 
 
progressdll
Guest
Posts: n/a
 
      22nd Dec 2006
I'm trying to change the behaviour of setting the DataSource property
of combobox.

Here is the behaviour I now see.

Setting the DataSource property of combobox to an ArrayList will visual
display
the first value in the Text field of the combobox. ( or setting the
Text property ).

I don't want this to happen. Just load the DataSource, don't change the
Text property.

Any Ideas

 
Reply With Quote
 
 
 
 
Stephany Young
Guest
Posts: n/a
 
      22nd Dec 2006
Bind the datasource in the normal way, set the Selected index to -1 THEN
subscribe the eventhandler to the SelectedIndexChanged event (or whichever
event you are using):

combobox.DataSource = MyDataSource;
combobox.DisplayMember = "aaa";
combobox.ValueMember = "aaa";
combobox.SelectedIndex = -1;
combobox.SelectedIndexChanged += new
EventHandler(combobox_SelectedIndexChanged);


"progressdll" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to change the behaviour of setting the DataSource property
> of combobox.
>
> Here is the behaviour I now see.
>
> Setting the DataSource property of combobox to an ArrayList will visual
> display
> the first value in the Text field of the combobox. ( or setting the
> Text property ).
>
> I don't want this to happen. Just load the DataSource, don't change the
> Text property.
>
> Any Ideas
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the behaviour of DataSource property of combobox progressdll Microsoft Dot NET Framework Forms 0 21st Dec 2006 02:35 PM
DataSource property San Microsoft C# .NET 1 19th Dec 2004 10:45 AM
DataGrid setting DataSource setting focus to grid Shravan Microsoft C# .NET 0 10th Nov 2003 06:33 AM
Datasource property MS Microsoft Dot NET Compact Framework 1 12th Oct 2003 04:39 PM
Help -- datasource property vs databinding?? amy Microsoft ADO .NET 1 1st Aug 2003 03:38 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:09 PM.