0

when I start program I get error "Label not definied" in GoTo Resend line

module:

 Public Declare Sub UrlMkSetSessionOption Lib "urlmon.dll" _
(ByVal dwOption As Long, ByRef pBuffer As Any, _
ByVal dwBufferLength As Long, ByVal dwReserved As Long)

Public Type INTERNET_PROXY_INFO
dwAccessType As Long
lpszProxy As String
lpszProxyBypass As String
End Type
Public Const INTERNET_OPEN_TYPE_PROXY = 3
Public Const INTERNET_OPTION_PROXY = 38

Public Declare Function InternetSetOption Lib "wininet.dll" Alias "InternetSetOptionA" _
(ByVal hInternet As Long, ByVal lOption As Long, ByRef sBuffer As Any, ByVal lBufferLength As Long) As Integer
Public Declare Function InternetSetOptionStr Lib "wininet.dll" Alias "InternetSetOptionA" _
(ByVal hInternet As Long, ByVal lOption As Long, ByVal sBuffer As String, ByVal lBufferLength As Long) As Integer

form:

Private Sub Command6_Click()
Dim ipi As INTERNET_PROXY_INFO
ipi.dwAccessType = INTERNET_OPEN_TYPE_PROXY
ipi.lpszProxy = "46.37.165.113:17890"
ipi.lpszProxyBypass = ""

gstrProxyUserName = "ggggg"
gstrProxyPassword = "hhhhhh"

iRetVal = InternetSetOption(hHttpOpenRequest, INTERNET_OPTION_PROXY_USERNAME, gstrProxyUserName, Len(gstrProxyUserName))
iRetVal = InternetSetOption(hHttpOpenRequest, INTERNET_OPTION_PROXY_PASSWORD, gstrProxyPassword, Len(gstrProxyPassword))
GoTo Resend <<-- error

Form1.WebBrowser1.Navigate "http://whatismyipaddress.com/"

how to define GoTo Resend line ?

Edited by mike_2000_17: Fixed formatting

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by alone882
0

When you use GoTo to branch out of your logic, you have to define "Resend" as a location (a "paragraph", if you will) in your routine. Just put the word "Resend:" by itself on a line where you want your logic flow to branch to (don't forget the colon ":" symbol).

That being said, be aware that using GoTo in your code results in what's professionally referred to as "Flow-through logic" programs. It is known colloquially as "spaghetti code" because if you use GoTo too much to jump around in your program, your logic paths begin to resemble a plate of spaghetti. Granted, there are times when you can't avoid it (such as using "On Error GoTo MyErrorRoutine") but you really should try to structure your functions and subroutines to avoid them...it makes them simpler and easier to understand.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.