Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using vb.net.In my form has combobox. I want automatically add text to combobox list which is I enter the combobox. I give the following coding. And I Create one setting which is ComboBox1 the Settings of the Properties.My Combobox name is ComboBox1.But the Error is displayed, Properties is not declared. So please help me solve this problem

Form Load Event

if Properties.Settings.Default.ComboBox1 = dbnull.Value
Properties.Settings.Default.ComboBox1 = new System.Collections.Specialized.StringCollection()
End if

private Sub Form1_FormClosing(object sender, FormClosingEventArgs e)
Properties.Settings.Default.ComboBox1.Clear()
Foreach  Item in ComboBox1.Items
Properties.Settings.Default.ComboBox1.Add(Item)
Next
End sub 
Posted
Updated 4-Mar-12 20:37pm
v3

I think you are trying to mix C# and VB.Net. In VB you access application settings using My.Settings, and the form closing event is declared like this]
VB
Private Sub Form1_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

    End Sub

You also don't say how your user is creating new items to enter into the combo box, and what method is used to save these temporarily, before closing the form.
 
Share this answer
 
What is or should properties be?
As its looking for an object or variable called properties

Are you developing something in XNA? as a quick Google shows that this is used heavily in XNA.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900