我正在尝试从文件中下载字符串,但收到以下警告
警告 BC42104:变量“inst”在被赋值之前被使用。运行时可能会导致空引用异常。
这是我的代码
Dim inst As WebClient
Dim inst2 As WebClient
Dim inst3 As WebClient
Try
MsgBox("started")
ver = inst.DownloadString("http://www.xxxxxxxxx.com/update/version.xml")
loc = inst2.DownloadString("http://www.xxxxxxxxx.com/update/loc.xml")
desc = inst3.DownloadString("http://www.xxxxxxxxx.com/update/description.xml")
If (String.Compare(ver, String.Format(Nothing, My.Application.Info.Version.Major.ToString) + "." + String.Format(Nothing, My.Application.Info.Version.Minor.ToString)) = False) Then
updreq = True
End If
Catch ex As Exception
MessageBox.Show("Error occured: " + ex.ToString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try