|
-
Jan 7th, 2010, 11:15 AM
#1
Thread Starter
Lively Member
[RESOLVED] on error goto doesn't work twice
hi,
I need something done for multiple textboxes. It works for the first one, but it reaches the second one, the debugging stops because of an error Normally it should go on to the next step when this error appears, but this only works for textbox1 
here's the code:
Code:
If CheckBox1.Checked = True Then
Dim ary() As String
ary = TextBox1.Text.Split(vbCrLf)
Dim i As Integer
i = 0
If TextBox1.Text <> "" Then
i = 0
TextBox1.Text = TextBox1.Text.Replace("megaupload", "megavideo")
Do
On Error GoTo nextstep2
ary = TextBox1.Text.Split(vbCrLf)
If ary(i).Contains("megavideo.com/?d=") Then
Dim webResponse3 As System.Net.HttpWebResponse = Nothing
Dim webRequest3 As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(ary(i))
webResponse3 = DirectCast(webRequest3.GetResponse(), System.Net.HttpWebResponse)
Dim srResp As System.IO.StreamReader
srResp = New System.IO.StreamReader(webResponse3.GetResponseStream())
Dim SOMESTRING As String
SOMESTRING = srResp.ReadToEnd
If SOMESTRING.Contains("video is unavailable") Then
If vlinks = "" Then
vlinks = "Video is not available"
Else
vlinks = vlinks & vbCrLf & "Video is not available"
TextBox28.Text = vlinks
End If
ElseIf SOMESTRING.Contains("This video has been removed due to infringement") Then
If vlinks = "" Then
vlinks = "Video is not available"
Else
vlinks = vlinks & vbCrLf & "Video is not available"
TextBox28.Text = vlinks
End If
Else
For h As Integer = 0 To SOMESTRING.Split("'").Length - 1 Step 1
If (SOMESTRING.Split("'")(h).ToLower().Contains("previewplayer/?v=")) Then
If vlinks = "" Then
vlinks = SOMESTRING.Split("'")(h).Replace("previewplayer", "http://megavideo.com")
Else
vlinks = vlinks & vbCrLf & SOMESTRING.Split("'")(h).Replace("previewplayer", "http://megavideo.com")
End If
TextBox28.Text = vlinks
End If
Next
End If
Else
If vlinks = "" Then
vlinks = "This line wasn't a MU/MV d-link"
Else
vlinks = vlinks & vbCrLf & "This line wasn't a MU/MV d-link"
TextBox28.Text = vlinks
End If
End If
i = i + 1
Loop
End If
nextstep2:
If TextBox2.Text <> "" Then
i = 0
TextBox2.Text = TextBox2.Text.Replace("megaupload", "megavideo")
Do
On Error GoTo nextstep3
ary = TextBox2.Text.Split(vbCrLf)
If ary(i).Contains("megavideo.com/?d=") Then
Dim webResponse3 As System.Net.HttpWebResponse = Nothing
Dim webRequest3 As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(ary(i))
webResponse3 = DirectCast(webRequest3.GetResponse(), System.Net.HttpWebResponse)
Dim srResp As System.IO.StreamReader
srResp = New System.IO.StreamReader(webResponse3.GetResponseStream())
Dim SOMESTRING As String
SOMESTRING = srResp.ReadToEnd
If SOMESTRING.Contains("video is unavailable") Then
If vlinks = "" Then
vlinks = "Video is not available"
Else
vlinks = vlinks & vbCrLf & "Video is not available"
TextBox28.Text = vlinks
End If
ElseIf SOMESTRING.Contains("This video has been removed due to infringement") Then
If vlinks = "" Then
vlinks = "Video is not available"
Else
vlinks = vlinks & vbCrLf & "Video is not available"
TextBox28.Text = vlinks
End If
Else
For h As Integer = 0 To SOMESTRING.Split("'").Length - 1 Step 1
If (SOMESTRING.Split("'")(h).ToLower().Contains("previewplayer/?v=")) Then
If vlinks = "" Then
vlinks = SOMESTRING.Split("'")(h).Replace("previewplayer", "http://megavideo.com")
Else
vlinks = vlinks & vbCrLf & SOMESTRING.Split("'")(h).Replace("previewplayer", "http://megavideo.com")
End If
TextBox28.Text = vlinks
End If
Next
End If
Else
If vlinks = "" Then
vlinks = "This line wasn't a MU/MV d-link"
Else
vlinks = vlinks & vbCrLf & "This line wasn't a MU/MV d-link"
TextBox28.Text = vlinks
End If
End If
i = i + 1
Loop
End If
End If
nextstep3:
all help is greatly appreciated!
if you know another method to go to the next step when an error occurs (the error is that arr(i) doesn't exists anymore) it's good as well
thanks in advance
LW
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|