Click here to Skip to main content
Sign Up to vote bad
good
See more: VBVisualStudio2012
Can you help me please?
I have that part of code in Visual Basic made in visual Studio 2012..But it shows an error that: " 'AddItem' is not member of 'System.Windows.Forms.ComboBox'. "
 
What can I do to fix it and add item to combobox?
 

here is the code:
 
ComboBox1.AddItem("4")
        ComboBox1.AddItem("5")
        ComboBox1.AddItem("6")
        ComboBox1.AddItem("7")
        ComboBox1.AddItem("8")
        ComboBox1.AddItem("9")
        ComboBox1.AddItem("10")
        ComoBox1.ListIndex = 0
Posted 17 Jan '13 - 9:40
San Dra391

Comments
Sergey Alexandrovich Kryukov - 17 Jan '13 - 16:56
Please stop re-posts. You need to follow-up with all your related question on the same page of your original post. —SA

1 solution

It isn't! Laugh | :laugh: It's a property of the Items collection.
Try:
        ComboBox1.Items.Add("4")
        ComboBox1.Items.Add("5")
        ComboBox1.Items.Add("6")
        ComboBox1.Items.Add("7")
        ComboBox1.Items.Add("8")
        ComboBox1.Items.Add("9")
        ComboBox1.Items.Add("10")
        ComoBox1.ListIndex = 0
  Permalink  
Comments
San Dra - 17 Jan '13 - 15:51
Ok :)
San Dra - 17 Jan '13 - 15:53
Still the same error, so I tried this and it worked: ComboBox1.Items.Add("4") ComboBox1.Items.Add("5") ComboBox1.Items.Add("6") ComboBox1.Items.Add("7") ComboBox1.Items.Add("8") ComboBox1.Items.Add("9") ComboBox1.Items.Add("10") ComoBox1.ListIndex = 0
OriginalGriff - 17 Jan '13 - 16:23
You're right - there is no AddItem method. c*** up on my part, I didn't remember to change it. Coffee! Coffee! I need coffee... :laugh:
San Dra - 17 Jan '13 - 16:41
ahahah you're funny :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 216
1 Richard MacCutchan 145
2 Sergey Alexandrovich Kryukov 129
3 Tadit Dash 129
4 Santhosh G_ 115
0 Sergey Alexandrovich Kryukov 10,338
1 OriginalGriff 7,965
2 CPallini 4,201
3 Rohan Leuva 3,522
4 Maciej Los 3,159


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid