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?
I currently have an XML file that contains about 115,000 codes along with addition information (description, "see also" information, etc), and is about 8.5MB in size. Unfortunately I did not create the file and cannot change it's format; must be used as is.
I've never worked with a file of this size. Just trying to open the file to look at the format was cause slow-down while opening and trying to scroll through it. However, for my application, I need to be able to dynamically update drop-down list with the codes (as the user starts to type in a code), as well as do search for codes.
I'm thinking this file is too large to load into an XDoc object or into a custom sorted list (key=code, value=description). I'm hoping someone has had experience working with similarly large XML files and has some suggestions on the most efficient way to work with a file like this.
1) Load the data into a SQL server table.
2) Have your application access and manipulate the data in the database.
3) Whenever you need the file, then run a routine to export the data from the database to the XML file.
in THAT page (the page in your link - or even ANY other page you wish)
first assess if the FRAME or IFRAME tag is present and if it is then load the SRC file that the individual FRAME SRC points to and then run your code for EACH frame and treat each frame as a separate html document.
If the fields your looking for are there then your code will do what its supposed to and if not then your code shouldnt do anything and you simply continue to the next frame.
If theres NO frames then your code will operate as normal....
See the pseudo code below
'1 Get the ORIGINAL document
'2 look for the FRAME tag (if no frame tags jump to step 10)
'3 in the frame tag look for the SRC attribute/element
'4 load the document using the SRC as the file to load pointer
'5 == YOUR CODE HERE ==
'6 we are done with this document
'7 we are done with this frame
'8 move to the next frame (and repeat till no more frames)
'9 All done - jump to step 12
'10 == YOUR CODE HERE ==
'11 All done - jump to step 12
I currently have an array populated with string values and am trying to compare the values in the array to other string values, but I am getting an error. The error message is “Conversion from string "SDrug" to type 'Boolean' is not valid”. Here is the code I have written.
“If IndustrySectorContentArray(IndustrySectorCounter) = "SFinancials" Or "SDrug" Then “.
If I just compare the content in the array to "SFinancials" then I don’t have an issue, but when I add the “Or” command I am getting the error.
Can someone point me in the right direction to get the desired result?
I am trying to generate a report from a data table with an unknown number of columns at design time. The application allows the user to choose what column to show, and I don't know how to bind a table with an unknown schema. Can someone please give me some points and avice about how to do this?
Mickabooh Systems LLC
I'm using Stored Procedure,3 tier and VB.net.
Now, i click the gridview and then want to show the data in textboxes and pictureBox to update the informations.
The problem is that , how can i retrieve photo to picture box???
Function Company_Save(ByVal M_Model_DA As Model.M_Company) AsStringTry
cmd = New SqlCommand()
cmd.CommandText = "SP_HR_Company_Insert"
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@Company_Logo", SqlDbType.Image).Value = M_Model_DA.Company_Logo
err_message = cmd.ExecuteNonQuery()
Catch ex As Exception
err_message = ex.ToString()
Function Company_Save(ByVal M_Company_BL As Model.M_Company) AsStringTry
DA_Company = New DataAccess.DA_Company()
error_message = DA_Company.Company_Save(M_Company_BL)
Catch ex As Exception
error_message = ex.ToString()
PublicProperty Company_Logo() AsByteGetReturnMe.CompanyLogo
EndGetSet(ByVal value AsByte)
Me.CompanyLogo = value
BL_Company = New BusinessLogic.BL_Company()
M_Comapny = New Model.M_Company()
M_Comapny.Company_Logo = Convert.ToByte(browseCompanyLogo.Value)
error_message = BL_Company.Company_Save(M_Comapny)
If error_message > 0Then
EndIfCatch ex As Exception
EndTryPrivateSub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
But It Shows Input Stream was not in a correct format . Why ? please !
Hi I've recently started programming and for a project i need to learn how to create my own AI program and i need to understand how it is done I need to know everything from opening VB i can do basic thing in VB but i have no idea were to even start with this can someone help please from the very start or at least help a little Thankyou anyone who helps
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
I don't want to make a very complex one just one that can make replys and activate event from speech, not to complex ofcourse i know there is AI programs you can download like this like helpful AL like that basically.