|
Post by Lazer on Mar 15, 2004 14:06:58 GMT -5
ok guys i have a listview and im adding my info to the listview perfect and writeing it to an ini file but when i want to load that info from the ini file on "form load" it wont split up what i have in the ini file e.g
irc.isyourgod.com 6667
i want to add the server in the first coloum and the port in the outher and this is what i have
Dim Temp Open "Server.ini" For Input As #1 Do While Not EOF(1) Line Input #1, Temp Temp = split(Temp, " ") Set mItem = Serverlist.ListItems.Add(, , Temp) Loop Close #1
any ideas where im going wrong ? thanks
|
|
|
Post by Dangermouse on Mar 15, 2004 14:30:34 GMT -5
Temp = split(Temp, " ")
Using split like that returns an array, think about it.
|
|
Pepper
New Member
meep meep...!
Posts: 444
|
Post by Pepper on Mar 15, 2004 14:44:38 GMT -5
Temp(2) could be an idea?
|
|
|
Post by Dangermouse on Mar 15, 2004 14:53:50 GMT -5
No, there is a better way just using split, no need for a array, its quite simple lol
|
|
|
Post by Lazer on Mar 15, 2004 15:04:37 GMT -5
Temp = Split(Temp, " ")(1)
|
|
|
Post by Dangermouse on Mar 15, 2004 15:16:26 GMT -5
Yup, on a side note lazer i just made a class to parse an ini file ( was bored )
|
|
|
Post by Lazer on Mar 15, 2004 17:10:05 GMT -5
cool
i also found a beter way of doing it
(Left$(Temp, InStr(Temp, "|") - 1))
|
|
Pepper
New Member
meep meep...!
Posts: 444
|
Post by Pepper on Mar 16, 2004 7:54:04 GMT -5
Sorry ment split(Temp," ")(1) got confused about the array thingy long time since ive used vb
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Mar 16, 2004 11:11:45 GMT -5
you shouldnt read an ini file like that
|
|
Maverick
New Member
www.mavetech.tk
Posts: 174
|
Post by Maverick on Mar 16, 2004 11:30:40 GMT -5
Dim Content as string Dim Temp() as string 'dont forget as string, its better than variant Open "File.ini" for input as #1 Content = Input$(Lof(1),#1) Close #1 Temp = split(Content," ")
|
|
|
Post by Dangermouse on Mar 16, 2004 11:58:15 GMT -5
you shouldnt read an ini file like that All good and well saying that, but how about mentioning the 'proper' way of doing it..
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Mar 17, 2004 1:53:44 GMT -5
I shouldn't have to. Any half a** windows programmer would know there are api calls for handling reading and writting data in an .ini file. Not to mention its not hard to type "how to write to ini files in vb6" in google an look for some results it just a little fucn effort.
|
|
|
Post by Dangermouse on Mar 17, 2004 2:32:35 GMT -5
lol, i know you were referring to me, and yes i did know there were calls actually. And to say "theres an api" for it would have taken less effort than typing that
|
|
Maverick
New Member
www.mavetech.tk
Posts: 174
|
Post by Maverick on Mar 17, 2004 9:55:31 GMT -5
why use API's when u can use small functions
|
|
|
Post by Lazer on Mar 17, 2004 11:01:02 GMT -5
i guess u where saying that to me ? and for 1 i will write to any flowering file i want to, the way i flowering want to. no wonder this section is dead when u go around calling ppl "half a** windows programmer", prick
|
|