String Handling

VB_Alien
01-06-2008, 07:59 AM
I made a little chat program and all is working fine but i expect
trouble down the road with the string data that i want to hold.

How my program works is after a message window pops up, the
user on the other end types in their response and the message
window closes. All the message data i want to hold on to is in
a rich text box but when the message window is closed, all the
data is lost.

I was using a string variable to hold all the data in memory but
i was afraid that after a while the string would be to full to hold
any more data and then an error would occur.

Right now at this point, i thought about declaring a public variable
as a rich text box but the problem with that is that i need to set
that control so i would still loose my data.

I was just wondering if you guys have any better ideas on how
to hold string data in memory.

dilettante
01-06-2008, 08:46 AM
"Too large" would be pretty darned large.

I'm not sure why you want to do this, but the biggest problem is as the String grows operations will become slower because of how these operations work (copying and recopying the data).

Maybe use a String array? Hold each "message" in one array element?

VB_Alien
01-06-2008, 08:47 AM
Maybe i asked for help to soon. I created a Sub Main and just
set the control right at the start of the programs. Can anyone tell
me if this will work without string overload?

Sub main()

Set TextHolder = frmMessage.RTB1
Load frmServer
frmServer.Show

End Sub


Then i have TextHolder holding the entire chat session until i
close the app down.

Rockoon
01-06-2008, 08:49 AM
Too Large in VB98, I believe, is some size greater than 1 gigabyte but less than 2 gigabytes.. not sure on the exact details.

the master
01-06-2008, 10:06 AM
I dont think that method will work. When you set a variable to equal a control its just a pointer to it so when the form is unloaded (along with the control) i believe that the variable will become nothing and wont retain any of the data. An array like dilletante suggested or a collection would be the best way to go even if you dont think you will reach 1GB of data. They will make it easier to access the data

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum