Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If txtSubd.Text = "" Then 'If the input is blank
'DO NOTHING
Else ' If its not, proceed
Dim wb As New WebClient
If wb.DownloadString(txtSubd.Text) = "" Then 'Check if the file entered is blank
MsgBox("Text file is Blank.", MsgBoxStyle.Exclamation, "Error")
Else 'If not, proceed
My.Forms.frmMain.TXTFILE.Text = txtSubd.Text
End If
End If
End Sub
So far this works, unless I enter random text. I need this only to run if a online .txt is entered.
I tried System.IO.File.Exists, but thats more local files right? ANy help would be much appreciated. Thanks guys!
Detect if the textbox contains a legit URL (notice the line: If hwresponse.StatusCode = Net.HttpStatusCode.OK, thats the ticket to confirm its not a 404) :