[Solved] Help With Visual Basic Programming Challenge

I am trying to create a program that grabs 3 users' names and finishing times, compares the numbers, and then displays the names of who finished a race the fastest. For reference, I am trying to solve Programming Challenge #4 on page 279 of the book Visual Basic 2012 Sixth Edition. I already have the following code. I have tested it, and it works. However, I need to figure out how to include a way to check errors against the following: "No runner name can be blank, and finishing times must be both numeric and positive."

http://pastebin.com/M8TVvMug

Any help would be greatly appreciated. If you need anymore information, just ask.

you would have to check the times to be not less than zero and not null.

if txtrunner1.text= "" or txtrunner2.text = "" or textrunner3.text = "" then

msgbox("No runner name can be blank")

else

[rest of code]

end if

Thanks for the quick responses. I'll give those suggestions a try.

[Edit]

splodgemolly, your suggestion worked; however, I'm still not understanding where or how to insert anarekist's suggestion. If one of you guys could elaborate on that part, it would be much appreciated. In the meantime, I'll see if I can figure it out on my own.

If String.IsNullOrEmpty(txtRunner1.Text) Then
         Return "is null or empty"

the less than zero check:

if If Sgn(decTimeOne) = -1 Then //checks to see if it's negative

I'm still having trouble with negative numbers. I tried using your suggestion, anarekist, but the program still allows negative numbers to be calculated. Here's the updated code...

http://pastebin.com/HuMh0kxr

Where and how would I insert your suggestions above? I likely did it incorrectly, but I tried using the less than zero check and it still didn't work. I did get the "No runner name can be blank" part taken care of, but the "finishing times must be positive" part is still giving me problems.

else if (Sgn(decTimeOne) = -1) or (Sgn(decTimeTwo) = -1) or (Sgn(decTimeThree) = -1) Then

MessageBox.Show("Error: Please check input for errors.", "Input Error!")

 

Sgn() only returns 1 or -1 depending on the sign so if  it's returning -1 it's negative and should error out

http://msdn.microsoft.com/en-us/library/office/gg264389.aspx

Thanks for all the help guys. I finally got it to work. The Sgn function goes by "Math.Sign()" in Visual Studio Express 2012. That's why I couldn't get it work.

Once again, thanks for your time! I really appreciate it.

werd, coding problems are fun.

For anyone that is interested, here's the complete and finished code...

http://pastebin.com/wtr4kq0y

Feel free to use it, modify it, criticize it, etc. I'm just glad I'm finished with the assignment.

thank you Deus, for changing the topic to [solved]. you sir, are a Sir.