Manish Pansiniya’s Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

Listbox datasource binding issue

with one comment

We have one project in which we have issue in databinding after deleting the datasource.

Following is the code that is creating issue

lstBox.DataSource = Nothing
 
lstBox.DisplayMember = "DisplayMem"
lstBox.ValueMember = "ValueMem"
 
lstBox.DataSource = lstBindingSource

The issue in executing the above code present the listbox with the class name in the list box. e.g. MyNamespace.Person

I have changed code to following and it resolves the issue somehow :( .

lstBox.DataSource = Nothing
lstBox.DataSource = lstBindingSource
lstBox.DisplayMember = "DisplayMem"
lstBox.ValueMember = "ValueMem"
 

Written by Manish

October 24, 2007 at 11:55 am

Posted in .NET

One Response

Subscribe to comments with RSS.

  1. listbox.DisplayMember=”Membertext”;
    listbox.ValueMember=”ValueFied”;
    listbox.datasource=ob.Display(); //returns collections

    aman

    May 27, 2009 at 1:22 pm


Leave a Reply