Results 1 to 7 of 7

Thread: Quick Question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    98
    If I build a list into a combo box and create a method of adding to that list. Can the list be modified after compiling?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    Private Sub Command1_Click()
      Combo1.AddItem Text1.Text
    End Sub
    you can make Text1 equal to whatever you want, and and it to your list. Is this what you mean?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    I believe Crypt answered your question. Just be sure to set the combo box's style to "0"

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Posts
    98
    YES!

    So even after compiling I can permanently add things to the list dynamically?

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    well, not permanently, just for that run of your app, you would have to generate a file that saves your list contents, and then, open the file and load the list when you start the program...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6

  7. #7
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Here's something I just quickly wrote up
    Code:
    Option Explicit
    
    Private Sub Command1_Click()
        Combo1.AddItem Combo1.Text
    End Sub
    
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        Dim x As Integer
        Open "C:\Test.txt" For Output As #1
        For x = 0 To Combo1.ListCount - 1
            Print #1, Combo1.List(x)
        Next
        Close #1
    End Sub
    
    Private Sub Form_Load()
        Dim x As Integer
        Dim strCombo As String
        Open "C:\Test.txt" For Input As #1
        Do Until EOF(1)
            Line Input #1, strCombo
            Combo1.AddItem strCombo
        Loop
        Close #1
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width