msufreeman
Member
- Joined
- Jun 15, 2007
- Messages
- 8
- Programming Experience
- 1-3
Hello all,
I am pretty frustrated right now. I've been dealing with this problem for a few hours now and have no clue what the problem is.
I have a function that is written in one solution. I have reference to that solution in another project. I made no changes to the function but it is now going crazy. I am sending it an array, cycling through it and building a string out of the array, and concatenating a comma after each value in the array.
When it gets to the last entry in the array, it adds the entry but does not add the comma to the end.
After it breaks out of the loop that cycles out of the array there are 2 commands that as I watch in debug get hit by the program but are then ignored. I can F10 through each one, the debugger stops on each one, but by watching the string it is building, the commands are not doing anything.
Here is the code I wrote, perhaps that will make things a little more clear:
When it gets to the part to where it attempts to run the api command I have built, the command does not work because the line where it should take off the last comma and then add a close parentheses are not doing anything.
A few notes of interest:
-I wrote this function (there is more to it, I just showed the most relevant part) last week and tested it through a windows app. The function works fine and if I go in and manually add that ) at the end of apiCommand, it works.
-This function is called from 2 different places in my web app, one place is only sending one value in the array and it works fine. The other one is sending an array with multiple values, this is the one that causes the issue. I suppose it is possible that the multi valued array could be an issue, but when I tested the function last week it worked fine with arrays of 1 and any size beyond one that I tested.
-The two lines where they are now are getting skipped over by the debugger now (previously they were getting hit but ignored) and if i add any code in those 2 lines it gets ignored. Just on a whim I added a bunch of empty lines and put the two commands further down (see below), and they went back to being hit by the debugger but being ignored.
Here is what I mean by moving them down:
Sorry for the long winded post, but I was trying to include as much relevant info as possible.
Thanks for any help in advance.
I am pretty frustrated right now. I've been dealing with this problem for a few hours now and have no clue what the problem is.
I have a function that is written in one solution. I have reference to that solution in another project. I made no changes to the function but it is now going crazy. I am sending it an array, cycling through it and building a string out of the array, and concatenating a comma after each value in the array.
When it gets to the last entry in the array, it adds the entry but does not add the comma to the end.
After it breaks out of the loop that cycles out of the array there are 2 commands that as I watch in debug get hit by the program but are then ignored. I can F10 through each one, the debugger stops on each one, but by watching the string it is building, the commands are not doing anything.
Here is the code I wrote, perhaps that will make things a little more clear:
VB.NET:
Public Function SetAccountTelNums(ByRef SConnection As Socket, ByVal Account As String, ByVal telNums() As String) As Boolean
Dim sResult As String
Dim phoneNums() As String = telNums
Dim apiCommand As String = "setaccounttelnums " & Account & " ("
Dim i As Integer = 0
For i = 0 To phoneNums.Length - 1
apiCommand &= phoneNums(i) & ","
Next
apiCommand = apiCommand.Trim(",")
apiCommand &= ")"
Dim buff As Byte() = System.Text.Encoding.ASCII.GetBytes(apiCommand & vbCrLf)
When it gets to the part to where it attempts to run the api command I have built, the command does not work because the line where it should take off the last comma and then add a close parentheses are not doing anything.
A few notes of interest:
-I wrote this function (there is more to it, I just showed the most relevant part) last week and tested it through a windows app. The function works fine and if I go in and manually add that ) at the end of apiCommand, it works.
-This function is called from 2 different places in my web app, one place is only sending one value in the array and it works fine. The other one is sending an array with multiple values, this is the one that causes the issue. I suppose it is possible that the multi valued array could be an issue, but when I tested the function last week it worked fine with arrays of 1 and any size beyond one that I tested.
-The two lines where they are now are getting skipped over by the debugger now (previously they were getting hit but ignored) and if i add any code in those 2 lines it gets ignored. Just on a whim I added a bunch of empty lines and put the two commands further down (see below), and they went back to being hit by the debugger but being ignored.
Here is what I mean by moving them down:
VB.NET:
Public Function SetAccountTelNums(ByRef SConnection As Socket, ByVal Account As String, ByVal telNums() As String) As Boolean
Dim sResult As String
Dim phoneNums() As String = telNums
Dim apiCommand As String = "setaccounttelnums " & Account & " ("
Dim i As Integer = 0
For i = 0 To phoneNums.Length - 1
apiCommand &= phoneNums(i) & ","
Next
apiCommand = apiCommand.Trim(",")
apiCommand &= ")"
Dim buff As Byte() = System.Text.Encoding.ASCII.GetBytes(apiCommand & vbCrLf)
Sorry for the long winded post, but I was trying to include as much relevant info as possible.
Thanks for any help in advance.