468,103 Members | 1,229 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,103 developers. It's quick & easy.

Why isn't there "Item" property for combobox or listbox in C#?

Hi,
Just noticed that you're allowed to use combobox1.items.item property
in VB.NET but NOT in C#...
Intellisense doesn't show "item" property and build is failed.

Is there a specific reason for that or is it a mistake?
(Using VC# 2005 express + .NET 2.0)

Thanks,

Onur Güzel
Jun 27 '08 #1
8 1135
On Sun, 18 May 2008 11:50:22 -0700 (PDT), kimiraikkonen
<ki*************@gmail.comwrote:
>Hi,
Just noticed that you're allowed to use combobox1.items.item property
in VB.NET but NOT in C#...
Intellisense doesn't show "item" property and build is failed.

Is there a specific reason for that or is it a mistake?
(Using VC# 2005 express + .NET 2.0)
Try using the indexer [] instead, e.g.

MessageBox.Show("Third value is " +
comboBox1.Items[2].ToString());

Regards,
Gilles.
Jun 27 '08 #2
Hi

There is indexer to access the item in C# - Combobox1.Items[1] (equals ComboBox1.Items.Item(1)
of VB)

Regards, Alex
Jun 27 '08 #3
On May 18, 10:21 pm, Alex Meleta <amel...@gmail.comwrote:
Hi

There is indexer to access the item in C# - Combobox1.Items[1] (equals ComboBox1.Items.Item(1)
of VB)

Regards, Alex
Thanks for the tips, but just wondering the reason: Is entity of
indexer the reason of absense of "item"?

Thanks,

Onur
Jun 27 '08 #4
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET
Peter
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:54**********************************@34g2000h sf.googlegroups.com...
On May 18, 10:21 pm, Alex Meleta <amel...@gmail.comwrote:
>Hi

There is indexer to access the item in C# - Combobox1.Items[1] (equals
ComboBox1.Items.Item(1)
of VB)

Regards, Alex

Thanks for the tips, but just wondering the reason: Is entity of
indexer the reason of absense of "item"?

Thanks,

Onur
Jun 27 '08 #5
Onur,

Simple because item is a default property

Cor

"kimiraikkonen" <ki*************@gmail.comschreef in bericht
news:fc**********************************@y21g2000 hsf.googlegroups.com...
Hi,
Just noticed that you're allowed to use combobox1.items.item property
in VB.NET but NOT in C#...
Intellisense doesn't show "item" property and build is failed.

Is there a specific reason for that or is it a mistake?
(Using VC# 2005 express + .NET 2.0)

Thanks,

Onur Güzel

Jun 27 '08 #6
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET

In my idea a very prepossessed statement. You have that too about white and
black people?

Cor

Jun 27 '08 #7
On May 19, 5:28 am, "Peter Bromberg [C# MVP]"
<pbromb...@nospamDood.yahoo.comwrote:
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET
Peter"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:54**********************************@34g2000h sf.googlegroups.com...
On May 18, 10:21 pm, Alex Meleta <amel...@gmail.comwrote:
Hi
There is indexer to access the item in C# - Combobox1.Items[1] (equals
ComboBox1.Items.Item(1)
of VB)
Regards, Alex
Thanks for the tips, but just wondering the reason: Is entity of
indexer the reason of absense of "item"?
Thanks,
Onur
Thanks, but i think the full reverse of your statement. In my idea,
VB.NET is much more flexible and developer-friendly than C#.

Just my opinion :)

Thanks,

Onur
Jun 27 '08 #8
kimiraikkonen wrote:
On May 19, 5:28 am, "Peter Bromberg [C# MVP]"
<pbromb...@nospamDood.yahoo.comwrote:
>Correct. C# tends to be somewhat more "compact" and elegant than VB.NET
Peter"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:54**********************************@34g2000 hsf.googlegroups.com...
>>On May 18, 10:21 pm, Alex Meleta <amel...@gmail.comwrote:
Hi
There is indexer to access the item in C# - Combobox1.Items[1] (equals
ComboBox1.Items.Item(1)
of VB)
Regards, Alex
Thanks for the tips, but just wondering the reason: Is entity of
indexer the reason of absense of "item"?
Thanks,
Onur

Thanks, but i think the full reverse of your statement. In my idea,
VB.NET is much more flexible and developer-friendly than C#.

Just my opinion :)
And you are indeed entitled to your incorrect opinion.

<Runs for cover>

Alun Harford
Jun 27 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Drulli Rokk | last post: by
1 post views Thread by Thomas Wang | last post: by
1 post views Thread by Mark Sanders | last post: by
4 posts views Thread by Davids | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.