Advertisement

03.10.2008 at 07:42PM PDT, ID: 23230654
[x]
Attachment Details

How to add items to a Combo Box after creation

Asked by CompTeck2255 in Editors IDEs, Microsoft Visual Basic.Net, .Net Editors & IDEs

Tags: Microsoft, Visual Basic 2008, 2008

Hey,

I have got one simple (I hope) problem I have a program with 1 ComboBox, 2 Text Fields and 3 buttons.

Now what I am trying to do is onceI create the progrma and publish it I want to be able to add and belete items. But I would also like to have the items to be saved somewhere where after I exit out of the progrma the items will be saved. I think a .txt file should be sufficient.

Could you please help or provide some code that will help me out here,

Please note that I am using Visual Basic EXPRESS Edition 2008,

Thank You. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sw As New System.IO.StreamWriter("c:\MycomboboxItems.txt", True)
 
        Dim AddItem As String
        AddItem = TextBox1.Text
        ComboBox1.Items.Add(AddItem)
        sw.WriteLine(AddItem)
 
        If TextBox1.Text & TextBox2.Text = "" Then
            MsgBox("Please Input Name or Serial Number !")
        Else
            MsgBox("Created Sucessfully")
            sw.Close()
        End If
 
 
 
    End Sub
 
 
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sr As New System.IO.StreamReader("c:\MycomboboxItems.txt")
        Do While sr.Peek() >= 0
            ComboBox1.Items.Add(sr.ReadLine)
        Loop
        sr.Close()
 
 
 
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
 
    End Sub
 
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        End
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Form2.Show()
        Me.Hide()
    End Sub
End Class
[+][-]03.10.2008 at 11:27PM PDT, ID: 21093426

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 12:00AM PDT, ID: 21093549

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 12:04AM PDT, ID: 21093561

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 01:10AM PDT, ID: 21093792

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 01:33AM PDT, ID: 21093883

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 04:37AM PDT, ID: 21094668

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 04:40AM PDT, ID: 21094688

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 05:41AM PDT, ID: 21095076

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.11.2008 at 05:49AM PDT, ID: 21095141

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Editors IDEs, Microsoft Visual Basic.Net, .Net Editors & IDEs
Tags: Microsoft, Visual Basic 2008, 2008
Sign Up Now!
Solution Provided By: webtubbs
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.11.2008 at 07:39PM PDT, ID: 21102567

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628