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.datasource=ob.Display(); //returns collections


    May 27, 2009 at 1:22 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: