Board index » delphi » combobox to listbox?

combobox to listbox?

Hello all!

on my form I have a combobox and a listbox + a button
the items on my combobox each represents a file on my disk..
text1.txt, text2.txt etc.. etc.

then combobox item selected and I click the button it's supose to load
the textfile to listbox
listbox.loadfromfile ('text1.txt');

I thought I could solve it like this
if combobox.text := 'text1.txt' then
listbox.loadfromfile('text1.txt') else
if combobox.text := 'text2.txt' then
listbox.loadfromfile('text2.txt')

but this really don't work at all.. I looked in the help file, but it
don't have an example for this. Then I got a delphi book from a friend
of mine, but that one did't help much either... so.. I really..really
hope to collect some help/example here?..

regards
Jesper.

 

Re:combobox to listbox?


Well first of all you cant put a := into a query as := assigns a value
but does not query it. But further I think it would be more simple if
you code this in this way.

ListBox.Items.LoadFromFile(ComboBox.Text);

Alex
--
Author of the free Chatsystem PINO!
Available at http://pino.cjb.net

Re:combobox to listbox?


Quote
>ListBox.Items.LoadFromFile(ComboBox.Text);

Okay.. neat way to solve the problem... I renamed the files to text1.
text2.   etc. .etc..

but  how do I save to chose files

like
 listbox.items.savetofile(combobox.text);    ?????

Other Threads