I'm doing a homework which i need to create a pizza order form. I've created the form along with the codes but i'm getting errors when debugging it. Like the one below:
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(113) : error BC30451: Name 'txtSurname' is not declared.
This is the code to it:
If ds.Tables("CustInfo").Rows.Count = 0Then'If customer telephone number not found, inform user
'and move focus to customer surname input box
MsgBox("Number not found in database.")
cmdSave.Enabled = True
I wish i could put more but i'm limited to what i can post cause it long and i have other errors as well!
thank you , but i need to check if smtp server is ready , and if not i need to display a warning to user and cancel the sending process. If is ready i can begin sending emails.
i have found this code , but doesn't work when i test with a invalid smtp server name:
publicbool ValidSMTP(string hostName)
bool valid = false;
TcpClient smtpTest = new TcpClient();
NetworkStream ns = smtpTest.GetStream();
StreamReader sr = new StreamReader(ns);
valid = true;
If you give the Connect method an invalid hostname and port that cannot be connected, it'll throw a SocketException with the error code in it.
if the hostname is a real server but nothing is listening on 25, it'll throw a SocketException.
If the hostname is real and 25 is blocked by a firewall, you'll get a SocketException.
Sooo... what's with the lonely little "throw" statement? Remove that and your code will work. That is, assuming that the SMTP server is listening on port 25...
The problem with this code is that you're only testing the server connection, not the ability to send email. Just because the server responds to a connection request does not mean that the credentials given for the SMTP account to send an email will work.
That's why I said the best way to check is to actually send an email.
Using Vb.NET 2010
Would anyone have any suggestions, ideas, or code that might be able to help me with this idea?
Thank you in advance!
-== The PogoWolf ==-
Last Visit: 31-Dec-99 19:00 Last Update: 27-Mar-15 7:40