[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

(Joshua)

7/18/2002 9:34:00 PM

Hi All ~ I'm having trouble binding a listbox in C# (my first C#
project). Any help would be appreciated:

So my listbox initializes like this:
this.listBox1 = new System.Windows.Forms.ListBox();

And my databinding code is like this:
listBox1.DataSource = MyDS.Tables["Notes"].DefaultView;

But there isn't a "DataText" property for my list box. I think what I
need is the C# equivalent of listBox1.DataText = "NoteText" (that's
what I'd write in VB), but there's nothing. My listbox simply lists
"System.Data.DatarowView" for each record.

This must be simple....what am I doing wrong?

Thanks,
Josh
1 Answer

Frank Tse \(MS\)

7/24/2002 8:22:00 PM

0

Hi Joshua,

Here is a MMIT QuickStart sample on how to use DataTextField property on the
List control to specify how th elist binds each item to the properties of
the corresponding source object. You can find the sample from
http://www.gotdotnet.com/MobileQ..., Mobile Web Form Basics->List
Controls->Data Binding a List.

Hope this help,
Frank
"This posting is provided "AS IS" with no warranties, and confers no
rights."

"Joshua" <joshua_t_campbell@hotmail.com> wrote in message
news:cd2a05bf.0207181018.5da6da77@posting.google.com...
> Hi All ~ I'm having trouble binding a listbox in C# (my first C#
> project). Any help would be appreciated:
>
> So my listbox initializes like this:
> this.listBox1 = new System.Windows.Forms.ListBox();
>
> And my databinding code is like this:
> listBox1.DataSource = MyDS.Tables["Notes"].DefaultView;
>
> But there isn't a "DataText" property for my list box. I think what I
> need is the C# equivalent of listBox1.DataText = "NoteText" (that's
> what I'd write in VB), but there's nothing. My listbox simply lists
> "System.Data.DatarowView" for each record.
>
> This must be simple....what am I doing wrong?
>
> Thanks,
> Josh