Dont send to the same person twice

Okay i have created a program that sends outs messages on a website. I have coded in a method to make sure that the program does not send to the same person twice in the same session. Each person i send too has an id number. So for example a list of users i send too might look like this below:






So what i am doing right now is this. I have created a string in my program like this Dim SentTo(0 To 9999) As String . Then what i do is before i send a message to a user i check to make sure i have not sent to that userid first. The way i do this is i take the user id and take the first 4 numbers of the user id. So for example if the userid was 647466274552 the first 4 numbers would be 6474. So i check the string SentTo(6474). I do this with some code like the code below

if instr(1,SentTo(6474),"[647466274552]") then

If that id is already in that SentTo string then i know i have already added it because i have sent to that person. If not then i send to that person and i add in the user id 647466274552 but i add it in the string SentTo(6474) with [ marks around it like this [647466274552]. The reason i save the userid in whatever SentTo string its four first numbers are is so that i dont have one big string that builds up. The bigger the string the longer it takes to search to see if the userid is already in that string. This way keeps the strings from building up to big. The problem is my code still seems to be slowing down my program. I am looking for someone to give me the fastest most efficient way to check every single time before i send a message to a userid if that userid has already been sent too. When you bid please explain how and why you think your method will work much more efficient then my method does. Thanks

Kemahiran: Visual Basic

Lihat lagi: what was the, what is search string, up string, the string problem, the fastest website, string the, string problem, some search string, how to string, nick marks, i like the way you work, how do i save, whatever it takes, the big think, strings, Send, send message, same, outs, Instr, first person, dont, program basic string, send look, already send

Tentang Majikan:
( 55 ulasan ) toronto, Canada

ID Projek: #356099