Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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:40am
San Dra391
Comments
Sergey Alexandrovich Kryukov at 17-Jan-13 16:56pm
   
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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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  
v3
Comments
San Dra at 17-Jan-13 15:51pm
   
Ok :)
San Dra at 17-Jan-13 15:53pm
   
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 at 17-Jan-13 16:23pm
   
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 at 17-Jan-13 16:41pm
   
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 Guruprasad.K.Basavaraju 400
1 Shai Vashdi 334
2 Sergey Alexandrovich Kryukov 305
3 OriginalGriff 265
4 Peter Leow 171
0 Sergey Alexandrovich Kryukov 8,979
1 OriginalGriff 5,280
2 Peter Leow 4,010
3 Maciej Los 3,535
4 Abhinav S 3,263


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