|
-
Sep 18th, 2004, 06:45 PM
#1
Thread Starter
Fanatic Member
something is weird about this code...
hello,
I have a text file with two items in each line (seperated with a ",")
I use this code to put all the lines in a listview:
VB Code:
frmMain.ListView1.Sorted = False
Dim strbig As String
Open App.Path & "\text.txt" For Input As #1
strbig = Input(LOF(1), 1)
a() = Split(strbig, vbCrLf)
Close #1
For i = 0 To UBound(a) - 1
Set lvEdit1 = frmMain.ListView1.ListItems.Add(, , a(i))
Next i
everything works, the only thing is, in the 5th line the second item
comes before the first...
that's wierd... I don't know what is the problem....
can anyone help?
thanks
-
Sep 18th, 2004, 07:04 PM
#2
The picture isn't missing
From your code, it seems that it's a problem with the file. Post up the file you are using.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Sep 18th, 2004, 11:59 PM
#3
VB Code:
Dim strOne As String
Dim strTwo As String
Open App.Path & "\text.txt" For Input As #1
Do While Not EOF(1)
Input #1, strOne, strTwo
Set lvEdit1 = frmMain.ListView1.ListItems.Add(, , strOne)
Set lvEdit1 = frmMain.ListView1.ListItems.Add(, , strTwo)
Loop
Close #1
-
Sep 19th, 2004, 12:03 AM
#4
is the SET necessary? or just like a LET statement?
-
Sep 19th, 2004, 12:43 AM
#5
The picture isn't missing
For objects, SET is necessary. You can't use SET on non-objects (unlike in .net, a string is not an object,etc)
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Sep 19th, 2004, 01:45 AM
#6
i didn't see what made that an object, from the code... in fact, i still don't
-
Sep 19th, 2004, 09:09 AM
#7
Originally posted by dglienna
i didn't see what made that an object, from the code... in fact, i still don't
The problem is that dekelc is either not declaring his variables or they are global. For example in his code there is no Dim for either a() or i. Also missing is something like the following which would make it clearer that lvEdit1 is an object.
-
Sep 19th, 2004, 12:28 PM
#8
I guess that you used it because he did. That makes sense, I guess. Using it erroneously would prolly cause an error, anyways.
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
|