Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Text File and ListBox 1

Status
Not open for further replies.

cenwesi

Programmer
Jan 13, 2003
14
US
Apart from me having to read a text file line by line and using the listbox.additem(...) function, is there another way or a better way to do this. Like with datawindow we can use the importfunction. Infact are there any free activeX control that can be used???

 
You can import a text file into a datawindow using

l_ret=dw_1.ImportFile(ls_doc_path)

I use it all the time. Works like a champ. Be sure to define your datawindow with the same columns as your tab delimited text file.
 
i guess you missed my point... is there a similar function for a listbox or better yet and nice ActiveX control for doing this?
 
not for a listbox... your would have to loop through your result set using probably a fetch or retrieving into a datastore and looping through that....but I guess the point would be.. what functionality are you gaining by using a listbox?
 
you guys, i already know all the datawindow function. What i was hoping for was a similar function like importfile for listbox control
 
Maybe Sybase thought it was not worth it offering an ImportFile() function for a ListBox. It would have been nice to have it natively in PowerBuilder but you can write it yourself - reading and adding each line as an item in the listbox. See Help on FileOpen, FileRead, FileClose... functions. And if you declare this in your ancestor listbox, it is always available. As you know, a listbox can offer you only one column's data compared to a datawindow/datastore that can support multiple columns, dropdown-edit style, ShareData()...

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top