Я получаю эту ошибку, когда я запускаю свою программу:Объектная переменная или с переменной блока не установлена?
Первый шанс исключение типа «System.NullReferenceException» произошло в Microsoft.VisualBasic.dll
переменная объекта или переменная блока не установлена
Вот мой код:
Dim rt As String = ""
Dim out As String
Dim wRequest As WebRequest
Dim wResponse As WebResponse
Dim SR As StreamReader
Dim time As Date
time = Now()
Try
wRequest = WebRequest.Create(Address)
wRequest.Timeout = 10000
wResponse = wRequest.GetResponse
SR = New StreamReader(wResponse.GetResponseStream)
rt = SR.ReadToEnd
SR.Close()
Catch wex As WebException
Dim status As WebExceptionStatus = wex.Status
If status = WebExceptionStatus.Timeout Then
MessageBox.Show("Could not establish a connection to the selected exchange server.", "Connection Timed Out", MessageBoxButtons.OK, MessageBoxIcon.Warning)
ElseIf status = WebExceptionStatus.ConnectFailure Then
MessageBox.Show("Could not establish a connection to the selected exchange server.", "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning)
ElseIf status = WebExceptionStatus.ProtocolError Then
MessageBox.Show("Could not establish a connection to the selected exchange server.", "Connection Protocol Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Try
Можете ли вы опубликовать полный след стека исключения? – antiduh
@antiduh Я как бы новичок в VB.net, как я могу это сделать в VS 2012? Настроить точку разрыва где-нибудь? –