Dibatalkan

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:

82638757271

7547987537

285763296

32943758288

42348658782

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 lebih lanjut: up string, fastest website, string the, string problem, nick marks, like way work, whatever takes, strings, send message, same, outs, instr, first person, dont, program basic string, send look, already send, right person, message send program, userid, send messages, time string, send bid, check send, visual basic session

Tentang Majikan:
( 55 ulasan ) toronto, Canada

ID Projek: #356099