472,976 Members | 1,233 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,976 software developers and data experts.

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 1329
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Drulli Rokk | last post by:
Hi, Here's a question that has cost this newbie two days of headache already: How can I get my XSLT stylesheet to specify a maximum number of elements to process? I'm now using <xsl:for-each>...
1
by: lawrence | last post by:
I can't get this page to show in Internet Explorer, so I assume the error is quite grave. I'm using a PHP script to write the RSS file. In Netscape the page shows up as plain text. "Item" is...
5
by: Add and Paste | last post by:
Dear Access developers, I have a lot of cut and pasting to do from Excel to an Access form. But instead of just pasting, I want to "add then paste" the value. Does anybody have a way to do this?...
1
by: Thomas Wang | last post by:
i declare a hashtable in c#, i can not find "hashtable.item" property as the specification declared, What i can do? B.Rgds
1
by: Mark Sanders | last post by:
I am wanting to create my own "Item" for use in the "File|Add New Item" dialog window. Does anyone know of any resources which would point me in the right direction? FYI: The item I want to...
4
by: Davids | last post by:
darn stuck again! in my string array string myArray = string; Let's say I've put a string field into the first 3 items and I guess the other 23 must then be null, right? OK so is there any C#...
1
by: Chris | last post by:
Hey Okay using DataBinder.Eval in a repeater. My question is this - if the value is empy, eg the myDownloadFile is empty, how can i display different output than if it was populated. #...
2
by: COHENMARVIN | last post by:
I have a listbox of cities. The listbox is bound to a database table. But I want to add the option - "all cities" to the listbox. How do I do that? Thanks, Marvin
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.