Hello all.
I am writing a small ftp program to up- and download some files from a specified server. The user can put the server adress and username/password in textboxes. Now I am searching for a way to create my own error messages when there is a error with the connection (sample: username or password not correct, server not existing ...).
I used this small example code:
Try
Dim files As Array
FtpConnection1.Connect()
files = FtpConnection1.GetFiles()
ListBox1.Items.AddRange(files)
FtpConnection1.Close()
Catch ex As Exception
If FtpConnection1.IsConnected Then
FtpConnection1.Close()
End If
MessageBox.Show(Me, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
If there is a error I get a standard error message from the program but I want to get a error code to create my own error message.
So the question is: How can I get the error code when there is an error or exception?
Thanks.