kplcjl 17 Junior Poster

1. sumdollaramtDecimal has to be more than 0 for any sum to be added to it. This looks like a logic error. Should that be If dollaramtDecimal > 0 Then sumdollaramtDecimal += dollaramtDecimal?
2. You need a process to transfer the text from the text box to the numbers you are using to track the order. That isn't shown. Are you sure that dollaramtDecimal has the calculations loaded before you cleared the boxes? Something like

if IsNumeric(quantityTextBox.Text) and IsNumeric(dollaramtTextBox.Text) Then
Dim i int32
i = quantityTextBox.Text
dollaramtDecimal = dollaramtTextBox.Text
dollaramtDecimal *= i
End If

kplcjl 17 Junior Poster

Whoops, forgot something Do Until REQUIRES the loop to execute at least one time. You sure you don't want "Do While" instead?

kplcjl 17 Junior Poster

So many problems in so few lines
1. If you "Try Catch End Try", DO SOMETHING after the Catch. This function goes blythly on when the most blatent errors can occur. (IE it would run OK on my machine with your connection string. Or would it? Everything fails in the try blocks. Is Do Until Nothing <> newPhoneID an infinite loop? It still runs because this loop would eventually cause an exception.)
2. Have you debugged this function? IE stepped through the function step by step making sure your code isn't blowing up.
3. functions expect to return an object. IE in this string function execute "Return newPhoneID". With txtPhoneID.Text being set, this is basically a Sub. It should be txtPhoneID.Text = CreateNewPhoneID() if you want this to be a function.
4. Nothing in this function changes the database, is something else doing so?
5. Does the string set a phone id that doesn't exist?
6. Database developers - shut your eyes, walk away. (Shaking your head while doing so is OK.)

kplcjl 17 Junior Poster

Code at post #10, where method SetValue has value - ByVal parameter. Try to use reference - ByRef parameter.

Sub setvalue(ByRef a As Byte)
        a = 10
End Sub

NO, this was an example that an individual item in an array is a ByVal field. I WANTED to see two lines of 7 showing that I AM passing an actual VALUE, not a Reference, even if the value is contained in a reference. Try
Sub setvalue(ByVal a As Byte())
a(0) = 10
End Sub

If you think the original passed array has the same value in the first field, you are VERY wrong.

Interesting that I am logic impaired. I thought I was logical... readable, (at times) on the other hand...:)

kplcjl 17 Junior Poster

Hmmm, string is the odd duck value type because it acts like a reference type when you interface with C++. I bet that's true even if you compile your C++ in the .net framework. If you think about it, internally all data types are reference types. That's how you can change a local variable and the next time you look at it it has the same value. There are locations in memory where that data is stored and instead of copying the data to a new location the same memory location is used when passed as a ByRef object. (Again string is the odd duck. I bet BOTH variables get a new (same) reference location if passed byref and then changed)

kplcjl 17 Junior Poster

I understand Arrays in .net framework are reference type, however individual items should be value types when worked on as an individual item assuming the base object type is still a value type. The following code both produce "7" on the output lines:
Console.WriteLine(NumbersLcl(xc, yc).ToString())
setvalue(NumbersLcl(xc, yc))
Console.WriteLine(NumbersLcl(xc, yc).ToString())
Console.Read()
End Sub
Sub setvalue(ByVal a As Byte)
a = 10
End Sub

kplcjl 17 Junior Poster

That's interesting, I finally put a watch on isfound. I step through the code, it highlights isfound = False, I execute the next step so it looks like it executed the command. isfound is still true and the rest of the code acts like it is still true.

kplcjl 17 Junior Poster

Looks like I found a VB.Net compiler error in VS. This repeats the behavior just before the Else statement. Make the last statement an If... End If removes the error.
Sub Main()
Dim xc As Byte
Dim x0 As Byte
Dim x1 As Byte
Dim yc As Byte
Dim y0 As Byte
Dim y1 As Byte
Dim nums(4) As Byte
Dim NumbersLcl(2, 2) As Byte
Dim offset2 As Byte
Dim numconf As Byte
Dim Solve_vertically As Boolean
Dim isfound As Boolean ' is this configuration valid
xc = 1
yc = 0
x0 = 0
y0 = 1
x1 = 0
y1 = 0
nums(0) = 4
nums(1) = 6
nums(4) = 7
numconf = 0
isfound = True 'start as valid - find out if not
NumbersLcl(xc, yc) = nums(4)
NumbersLcl(x0, y0) = nums(0)
NumbersLcl(x1, y1) = nums(1)
Solve_vertically = True
If Solve_vertically Then
If y0 = yc And NumbersLcl(xc, yc) = NumbersLcl(x0, y0) Then isfound = False
If y1 = yc And NumbersLcl(xc, yc) = NumbersLcl(x1, y1) Then isfound = False
Else
If x0 = xc And NumbersLcl(xc, yc) = NumbersLcl(x0, y0) Then isfound = False
If x1 = xc And NumbersLcl(xc, yc) = NumbersLcl(x1, y1) Then isfound = False
End If
End Sub

kplcjl 17 Junior Poster

Upload a sample project demonstrating this behavior

That would be a little tough to do since my project isn't demonstating this behaviour now, I've found and corrected unrelated bugs in my code, and I probably couldn't create a small sample that would repeat the actions I saw.

I also don't know if adding the bugs back in and removing the one additional statement that cleared it up in the first place would cause the same behaviour now. (Even if I could remember the exact lines that I changed while fixing the bug.)

The entire program could in no way be considered a sample. It used to be repeatable, I established the conditional break, put the last two variables in a watch statement after I saw it evaluated to true. Saw they weren't the same value (6 & 7), went huh??? I stopped and reran the code, saw the variables remained 6 & 7 before the if statement, it still evaluated as true. Stopped the code, just added the one if statement shown in a previous thread. Both the old and the new if statements evaluated as false.

This all fits in the "IT CAN'T DO THAT!" statement that all of us at one time or another should have said at some times in our lives. I was hoping someone knew about how the debugging step function could produce an action it couldn't possibly do.
Just for grins I removed the added if statement again and it …

kplcjl 17 Junior Poster

Elaborate your question please.

Elaborate??? Okay. "If" statements evaluate a conditional statement and determine if the conditional statement is true or false to continue on. "If true and false then..." should ALWAYS come up with false and "If true or false then..." should ALWAYS come up with true in the conditional evaluation. I wasn't coming up with expected results so I turned trace on, stepped through the program and came up with a conditional statement that should have evaluated as false. IE "if 0=0 and 6=7 then..." was coming up as a true conditional. I asked why. When I looked at the variable values in the original statement. I wanted to know how I could turn a watch window on, verify the third and fourth variable values could be 6 and 7 and this still evaluates as a true statement.

As usual, I changed something in a different area and this statement starts behaving like it should have in the first place.
Immediately after the IF statement that was coming up true, I added immediately after it:
If y1 = yc Then
If NumbersLcl(xc, yc) = NumbersLcl(x1, y1) Then
isfound = False
End If
End If
(It said the first statement above was true and the second was false like it should have to begin with and the original line now evaluated as false as well.)
Both the original line and the new lines evaluated as false like it should have …

kplcjl 17 Junior Poster

On visual studio watch1
"NumbersLcl(xc, yc)" is 6,
"NumbersLcl(x1, y1)" is 7.
Both "y1" and "yc" are 0.
All variables are byte and NumbersLcl is (2,2) as byte. How can the following statement evaluate as true?

If y1 = yc And NumbersLcl(xc, yc) = NumbersLcl(x1, y1) Then isfound = False

kplcjl 17 Junior Poster

My name is Ken, over 50, graduated as a mechanical engineer. Days, working as a mechanical engineer --- 0. My wife has a lifetime interest in horses, I could leave them, but I do enjoy being a navigator in something called combined driving. (A three phase event, where only marathon brings in the navigator whose job is to keep the carriage or cart upright and to assist in where to go as one careens around corners as fast as possible.) 30+ years in computing, new to VB.net. Started looking for this board because of an "It CAN'T DO that!!!" problem that seems to happen consistently in the 30+ years of experiences. Visual studio is a great debugging tool, but even it has its moments.