locked
Combobox Dropdownlist save issue RRS feed

  • Question

  • I am currently trying to add items to a drop down list so that they can be seen the next time I run the program. N.B my combobox is part of my database

    The thing is when i click the add button the item save to the drop down list but when i click save and stop debugging i only get the last entry to appear, and no not in the drop down list the input text part of the combo box.

    Please someone help

    this is the code i use to add the text



     
      "GameComboBox.Items.Add(GameComboBox.Text)"
     


    Sunday, March 20, 2011 3:24 AM

Answers

  • Hi CranberryAce

    Option Strict On
    
    Public Class Form1
    
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'fill out the combobox from 0 to 10
        For i As Integer = 0 To 10
          ComboBox1.Items.Add(i)
        Next
        'display text in the combobox text field
        ComboBox1.Text = "Hello World"
      End Sub
    
    
    End Class
    

    For further study please kindly check the following link

    ComboBox Class
    http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx

    To save you can use my.settings or use a text file or...


    Be a good forum member. Make this forum a great place to meet and interact with others around the world.
    Sunday, March 20, 2011 3:35 PM

All replies

  • I am currently trying to add items to a drop down list so that they can be seen the next time I run the program. N.B my combobox is part of my database

    The thing is when i click the add button the item save to the drop down list but when i click save and stop debugging i only get the last entry to appear, and no not in the drop down list the input text part of the combo box.

    Please someone help

    this is the code i use to add the text



     
      GameComboBox.Items.Add(GameComboBox.Text)
     

    • Merged by Cookie Luo Monday, March 28, 2011 1:59 AM
    Sunday, March 20, 2011 3:16 AM
  • Post code showing where and how you initially load the CB with Items.

    Post code showing where and how you save the Items in the CB before your form closes.


    Mark the best replies as answers. "Fooling computers since 1971."

    http://rudedog2.spaces.live.com/default.aspx

    Sunday, March 20, 2011 2:08 PM
  • Hi CranberryAce

    Option Strict On
    
    Public Class Form1
    
      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'fill out the combobox from 0 to 10
        For i As Integer = 0 To 10
          ComboBox1.Items.Add(i)
        Next
        'display text in the combobox text field
        ComboBox1.Text = "Hello World"
      End Sub
    
    
    End Class
    

    For further study please kindly check the following link

    ComboBox Class
    http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx

    To save you can use my.settings or use a text file or...


    Be a good forum member. Make this forum a great place to meet and interact with others around the world.
    Sunday, March 20, 2011 3:35 PM
  • Hi

    Please do not post duplicate thread.

    http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/3c495c2a-1728-437c-99e2-239ecdf53c2c

    And please post some more code for us to do research.

    The following code has no problem. 

    GameComboBox.Items.Add(GameComboBox.Text)


    Thanks,


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 21, 2011 8:54 AM
  • Hi CranberryAce,

    Any update?

     

    How about the link source in VBstudy's suggestion? If it works, you can share your solutions & experience here, it will be very beneficial for other community members who have similar questions. Thanks.

     

    Best regards,


    Mike Feng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 25, 2011 6:36 PM
    Moderator
  • Hi CranberryAce,

     

    Thanks for posting in the MSDN Forum.

     

    Any update? I have marked VBStudy's reply as answer, if you think it provides no help, please unmark it.

     

    Thank you for your understanding and support.

     

    Best Regards,


    Mike Feng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 29, 2011 6:48 AM
    Moderator