Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kimiraikkonen - 18 May 2008 19:50 GMT
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
Gilles Kohl [MVP] - 18 May 2008 20:07 GMT
>Hi,
>Just noticed that you're allowed to use combobox1.items.item property
[quoted text clipped - 3 lines]
>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.
Alex Meleta - 18 May 2008 20:21 GMT
Hi

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

Regards, Alex
kimiraikkonen - 18 May 2008 21:02 GMT
> 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
Peter  Bromberg [C# MVP] - 19 May 2008 02:44 GMT
Correct. C# tends to be somewhat more "compact" and elegant than VB.NET
Peter
>> Hi
>>
[quoted text clipped - 10 lines]
>
> Onur
Cor Ligthert[MVP] - 19 May 2008 05:01 GMT
> 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
kimiraikkonen - 19 May 2008 09:47 GMT
On May 19, 5:28 am, "Peter  Bromberg [C# MVP]"
<pbromb...@nospamDood.yahoo.com> wrote:
> Correct. C# tends to be somewhat more "compact" and elegant than VB.NET
>
[quoted text clipped - 12 lines]
>
> > 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
Alun Harford - 19 May 2008 21:48 GMT
> On May 19, 5:28 am, "Peter  Bromberg [C# MVP]"
> <pbromb...@nospamDood.yahoo.com> wrote:
[quoted text clipped - 14 lines]
>
> Just my opinion :)

And you are indeed entitled to your incorrect opinion.

<Runs for cover>

Alun Harford
Cor Ligthert[MVP] - 19 May 2008 04:49 GMT
Onur,

Simple because item is a default property

Cor

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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.