|
-
Feb 25th, 2008, 09:44 PM
#1
Thread Starter
Lively Member
Been Awhile...In Need of Help Once More!
Hey everyone,
it sure has been sometime since I've been on this site, says my last visit was "Jul 25th, 2007"...Anyway, I had an issue, I was wondering if someone can toss me a code for loading a simple text file into a ListView1. I'd appreciate it, and will send thanks. Thanks in advanced.
-
Feb 25th, 2008, 10:00 PM
#2
Re: Been Awhile...In Need of Help Once More!
Code depends on how file is structured. Can you post any samples?
-
Feb 25th, 2008, 10:21 PM
#3
Hyperactive Member
Re: Been Awhile...In Need of Help Once More!
Uh, like this?
Code:
Option Explicit
Private Sub Command1_Click()
Dim L As String
Open "z.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, L
List1.AddItem L
Loop
Close #1
End Sub
Mac
-
Feb 25th, 2008, 10:30 PM
#4
Re: Been Awhile...In Need of Help Once More!
Don't rush into the answers - you don't know what the file looks like... Besides, he said "ListView1" not Listbox.
-
Feb 25th, 2008, 11:43 PM
#5
Hyperactive Member
Re: Been Awhile...In Need of Help Once More!
 Originally Posted by RhinoBull
Don't rush into the answers - you don't know what the file looks like... Besides, he said "ListView1" not Listbox. 
Uh, what is "ListView1"?
Mac
-
Feb 26th, 2008, 12:09 AM
#6
Re: Been Awhile...In Need of Help Once More!
 Originally Posted by Mr.Mac
Uh, what is "ListView1"?
Mac
ListView is a member of MSCommon Controls 6.0, found on the Components tab.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Feb 26th, 2008, 12:26 AM
#7
Thread Starter
Lively Member
Re: Been Awhile...In Need of Help Once More!
CdDrive is correct, but I applaud the effort in coding that part out for me. Rhino Bull, I dont have any code right now, I'm just attempting to make it to where I click command1, and I'm presented where I can navigate my files to the .txt file to load into the list.
-
Feb 26th, 2008, 12:36 AM
#8
Re: Been Awhile...In Need of Help Once More!
Rhino isn't asking for the source code. He's asking for sample data... the data in the text file or whats going to be transferred to the listview, to see if its columnar data and if so what's the delimiter.
-
Feb 26th, 2008, 12:50 AM
#9
Thread Starter
Lively Member
Re: Been Awhile...In Need of Help Once More!
Well my initial plan with this was to have the user press a button to load a list of e-mails into the ListView1
-
Feb 26th, 2008, 12:54 AM
#10
Re: Been Awhile...In Need of Help Once More!
 Originally Posted by vbnewbie2007
Well my initial plan with this was to have the user press a button to load a list of e-mails into the ListView1
Again, what's the content of the textfile? Is it single column, vbCrLf delimited data, e.g.
[email protected]
[email protected]
[email protected]
Or is it a comma-separated (or comma delimited) values file?
[email protected], "My Name is abc", "Age 20"
[email protected], "My Name is def", "Age 21"
[email protected], "My Name is ghi", "Age 22"
And lastly, for multi-column data which columns will be transferred to listview? All of them?
You are not answering the questions correctly which is just prolonging the discussion.
Last edited by leinad31; Feb 26th, 2008 at 07:45 PM.
-
Feb 26th, 2008, 08:41 AM
#11
Re: Been Awhile...In Need of Help Once More!
 Originally Posted by leinad31
You are not answering the questions correctly which is just prolonging the discussion.
Indeed... so I will try to ask once more:
CAN YOU POST SOME SAMPLE DATA THAT IS (OR WILL BE) IN YOUR FILE THAT YOU'RE PLANNING ON LOADING INTO YOUR LISTVIEW CONRTOL?
Thank you.
-
Feb 27th, 2008, 12:37 PM
#12
Thread Starter
Lively Member
Re: Been Awhile...In Need of Help Once More!
'Again, what's the content of the textfile? Is it single column, vbCrLf delimited data, e.g.
[email protected]
[email protected]
[email protected]'
it is single column, like how it was posted above.
-
Feb 27th, 2008, 08:04 PM
#13
Re: Been Awhile...In Need of Help Once More!
You can use code in post #3 or the following
Code:
Dim i As Long
Dim intFF As Integer
Dim arrLines() As String
intFF = FreeFile
Open "z.txt" For Input As #intFF
arrLines = Split(Input(LOF(intFF), #intFF) ,vbCrLf)
Close #intFF
For i = 0 To Ubound(arrLines)
'add to listview code goes here
Next
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|