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

  • Thread starter Thread starter kimiraikkonen
  • Start date Start date
K

kimiraikkonen

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
 
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.
 
Hi

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

Regards, Alex
 
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
 
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET
Peter
kimiraikkonen said:
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
 
Onur,

Simple because item is a default property

Cor

"kimiraikkonen" <[email protected]> schreef in bericht
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
 
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
 
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET

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"?

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
 
kimiraikkonen said:
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top