AuthorMessage
NeiSep
Ametuar
Posts: 93

Ok hello again lol well i have been posting this on some other forum without success you all probly know DC hehe atleast the most do so anyway you know how Hubregistration works and so on.
Well got an problem with TStringList well i can add new things to the list but i cant update the list with new info like for exampel i got a client sends me this:
[ADSL]Maximum Speed][Test|netfree.homeunix.net|[ADSL]Maximum Speed][20GB][Test - www.maximumspeed.se|1|0|
ok this would be the old text then and that is added to the StringList okey.
now we get a new info like this:
[ADSL]Maximum Speed][Test|netfree.homeunix.net|[ADSL]Maximum Speed][20GB][Test - www.maximumspeed.se|1230|0|
You see only digits have changed but you should be able to change the rest to anyway now i want to update this text so the old text get overwrited with this new text.
So the unique for this would be the adress so i got to search for the adress in the StringList and then replace the whole line and add the new line in that possition.
Anyone here who can help me with that i tried this:
Code:
for i := 0 to Hubs.Count - 1 do
//ListBox1.Items[s] := UpperCase(ListBox1.Items[Index]);
//memo3.Lines.Add(hubs[s]);
//memo3.Lines.Add(intToStr(i));
Idx:=Hubs.IndexOf(adress3);
if Idx > -1 then
memo3.Lines.Add('If'+intToStr(i)+'');
Hubs[i] := fulllist;
memo3.Lines.Add('Hub update...');

Mickey
Ametuar
Posts: 115

The easiest way is to change the whole string.
Code:
MyStringList[4] := 'Old text';
MyStringList[4] := 'New text';

NeiSep
Ametuar
Posts: 93

but doesnt this mean the same?
Hubs[i] := fulllist;
??
Meka][Meka
Unstopable
Posts: 700

yes it does, so maybe u will need to make some kind of object with a stringlist in, and a string as the hubname, then u can loop thru the oibjects to find which is correct, and then change the info, create a hubinfo builder function type of thing. If i wasnt working so much i would write an example...if i do get time, i will...
Mickey
Ametuar
Posts: 115

Quoted from NeiSep
but doesnt this mean the same?
Hubs[i] := fulllist;
??

If your fulllist is a string type then yes. I couldn't read from your code part how you declared.
Just do what Meka told.