Text File <=> Combo Box 
Author Message
 Text File <=> Combo Box

Brent

To get the file data into the ComboBox (Sorted = True):

Dim fileno As Integer
Dim rec$
fileno = FreeFile
Open "name" For Input As #fileno
ComboBox1.Cls
Do Until EOF(fileno)
    Line Input #fileno, rec$
    ComboBox1.AddItem rec$
Loop
Close #fileno

To write the file, use Print # statements.

Regards
{*filter*}


Quote:
>Hi all

>How do I use a text file to store list items of a Combo Box?

>I want to be able to use a text file to have List Item 1 on line 1,
Item 2
>on line 2, etc.  Then, I need my program to read each line as a list
item.

>If possible, It must be able to sort alphabetically these items.

>I also need to know how to add to the text file at run time.

>TIA,

>Brent W.J. Mackie
>=======================================

>ICQ#: 5113768
>WebPage:   http://www.*-*-*.com/
>Microsoft SiteBuilder Network Level 2
>=======================================



Sat, 02 Sep 2000 03:00:00 GMT  
 Text File <=> Combo Box

Brent

Dim fileno As Integer
Dim index As Long

fileno = FreeFile
Open "name" For Output As #fileno
For index = 0 To ListBox1.Count - 1
    Print #fileno, ListBox1.List(index)
Next index
Close #fileno

If you want to put it out to the same file, open Append instead of
Output. In this case, you'll have to distinguish the different records
in some way so that you can reload from the file correctly.

Regards
{*filter*}



Quote:
>Thanks,{*filter*}.

>As a continuation of this, how would I take the entire contents of a
ListBox
>and print it to the same file?

>Brent W.J. Mackie
>=======================================

>ICQ#: 5113768
>WebPage:   http://www.*-*-*.com/
>Microsoft SiteBuilder Network Level 2
>=======================================


>>Brent

>>To get the file data into the ComboBox (Sorted = True):

>>Dim fileno As Integer
>>Dim rec$
>>fileno = FreeFile
>>Open "name" For Input As #fileno
>>ComboBox1.Cls
>>Do Until EOF(fileno)
>>    Line Input #fileno, rec$
>>    ComboBox1.AddItem rec$
>>Loop
>>Close #fileno

>>To write the file, use Print # statements.

>>Regards
>>Dick


>>>Hi all

>>>How do I use a text file to store list items of a Combo Box?

>>>I want to be able to use a text file to have List Item 1 on line 1,
>>Item 2
>>>on line 2, etc.  Then, I need my program to read each line as a list
>>item.

>>>If possible, It must be able to sort alphabetically these items.

>>>I also need to know how to add to the text file at run time.

>>>TIA,

>>>Brent W.J. Mackie
>>>=======================================

>>>ICQ#: 5113768
>>>WebPage:   http://www.*-*-*.com/
>>>Microsoft SiteBuilder Network Level 2
>>>=======================================



Sun, 03 Sep 2000 03:00:00 GMT  
 Text File <=> Combo Box

Brent

OK. You've got me beaten. Which bits of my code were not compatible with
VB5?

Regards
{*filter*}


Quote:
>Thank you very much,{*filter*}.

>The code is working well now with a few minor changes to be compatible
with
>VB5.

>Brent W.J. Mackie
>=======================================

>ICQ#: 5113768
>WebPage:   http://www.*-*-*.com/
>Microsoft SiteBuilder Network Level 2
>=======================================


>>Brent

>>Dim fileno As Integer
>>Dim index As Long

>>fileno = FreeFile
>>Open "name" For Output As #fileno
>>For index = 0 To ListBox1.Count - 1
>>    Print #fileno, ListBox1.List(index)
>>Next index
>>Close #fileno

>>If you want to put it out to the same file, open Append instead of
>>Output. In this case, you'll have to distinguish the different records
>>in some way so that you can reload from the file correctly.

>>Regards
>>Dick



>>>Thanks,{*filter*}.

>>>As a continuation of this, how would I take the entire contents of a
>>ListBox
>>>and print it to the same file?

>>>Brent W.J. Mackie
>>>=======================================

>>>ICQ#: 5113768
>>>WebPage:   http://www.*-*-*.com/
>>>Microsoft SiteBuilder Network Level 2
>>>=======================================


>>>>Brent

>>>>To get the file data into the ComboBox (Sorted = True):

>>>>Dim fileno As Integer
>>>>Dim rec$
>>>>fileno = FreeFile
>>>>Open "name" For Input As #fileno
>>>>ComboBox1.Cls
>>>>Do Until EOF(fileno)
>>>>    Line Input #fileno, rec$
>>>>    ComboBox1.AddItem rec$
>>>>Loop
>>>>Close #fileno

>>>>To write the file, use Print # statements.

>>>>Regards
>>>>Dick


>>>>>Hi all

>>>>>How do I use a text file to store list items of a Combo Box?

>>>>>I want to be able to use a text file to have List Item 1 on line 1,
>>>>Item 2
>>>>>on line 2, etc.  Then, I need my program to read each line as a
list
>>>>item.

>>>>>If possible, It must be able to sort alphabetically these items.

>>>>>I also need to know how to add to the text file at run time.

>>>>>TIA,

>>>>>Brent W.J. Mackie
>>>>>=======================================

>>>>>ICQ#: 5113768
>>>>>WebPage:   http://www.*-*-*.com/
>>>>>Microsoft SiteBuilder Network Level 2
>>>>>=======================================



Mon, 04 Sep 2000 03:00:00 GMT  
 Text File <=> Combo Box

Brent

Oops, sorry, my careless mistakes. I'm getting too used to
auto-prompting in VB5!

Regards
{*filter*}


Quote:
>lol

>Umm....  I think the ListBox1.Count turned to ListBox1.ListCount,
>ComboBox1.Cls => ComboBox1.Clear

>Just a couple things like that.  That's all I can remember off the top
of my
>head.

>Thanks again

>Brent W.J. Mackie
>=======================================

>ICQ#: 5113768
>WebPage:   http://www.*-*-*.com/
>Microsoft SiteBuilder Network Level 2
>=======================================

>>Brent

>>OK. You've got me beaten. Which bits of my code were not compatible
with
>>VB5?

>>Regards
>>Dick


>>>Thank you very much,{*filter*}.

>>>The code is working well now with a few minor changes to be
compatible
>>with
>>>VB5.

>>>Brent W.J. Mackie
>>>=======================================

>>>ICQ#: 5113768
>>>WebPage:   http://www.*-*-*.com/
>>>Microsoft SiteBuilder Network Level 2
>>>=======================================


>>>>Brent

>>>>Dim fileno As Integer
>>>>Dim index As Long

>>>>fileno = FreeFile
>>>>Open "name" For Output As #fileno
>>>>For index = 0 To ListBox1.Count - 1
>>>>    Print #fileno, ListBox1.List(index)
>>>>Next index
>>>>Close #fileno

>>>>If you want to put it out to the same file, open Append instead of
>>>>Output. In this case, you'll have to distinguish the different
records
>>>>in some way so that you can reload from the file correctly.

>>>>Regards
>>>>Dick



>>>>>Thanks,{*filter*}.

>>>>>As a continuation of this, how would I take the entire contents of
a
>>>>ListBox
>>>>>and print it to the same file?

>>>>>Brent W.J. Mackie
>>>>>=======================================

>>>>>ICQ#: 5113768
>>>>>WebPage:   http://www.*-*-*.com/
>>>>>Microsoft SiteBuilder Network Level 2
>>>>>=======================================




- Show quoted text -

Quote:
>>>>>>Brent

>>>>>>To get the file data into the ComboBox (Sorted = True):

>>>>>>Dim fileno As Integer
>>>>>>Dim rec$
>>>>>>fileno = FreeFile
>>>>>>Open "name" For Input As #fileno
>>>>>>ComboBox1.Cls
>>>>>>Do Until EOF(fileno)
>>>>>>    Line Input #fileno, rec$
>>>>>>    ComboBox1.AddItem rec$
>>>>>>Loop
>>>>>>Close #fileno

>>>>>>To write the file, use Print # statements.

>>>>>>Regards
>>>>>>Dick


>>>>>>>Hi all

>>>>>>>How do I use a text file to store list items of a Combo Box?

>>>>>>>I want to be able to use a text file to have List Item 1 on line
1,
>>>>>>Item 2
>>>>>>>on line 2, etc.  Then, I need my program to read each line as a
>>list
>>>>>>item.

>>>>>>>If possible, It must be able to sort alphabetically these items.

>>>>>>>I also need to know how to add to the text file at run time.

>>>>>>>TIA,

>>>>>>>Brent W.J. Mackie
>>>>>>>=======================================

>>>>>>>ICQ#: 5113768
>>>>>>>WebPage:   http://www.*-*-*.com/
>>>>>>>Microsoft SiteBuilder Network Level 2
>>>>>>>=======================================



Mon, 04 Sep 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Text File <=> Combo Box

2. <<<<<<<<ComboBox>>>>>>>>>>>>

3. <<<Cneck Box>>>

4. HELP >>>>>>WIN API <<<<<<<<<<

5. <<<Gif Files>>>

6. ----->>Faster way to open TEXT FILES...<<------

7. >>>> WAV file GRAPH <<<<<<<

8. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

9. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

10. <<<<HELP- OLE container Control>>>>>>>>>

11. VB5<->RDO2<->ODBC<->ORACLE Procedure Problem

12. <<<CD ROM>>>

 

 
Powered by phpBB® Forum Software