
webbrowser object reference not set to an instance of an object
Publicado por ricard (13 intervenciones) el 17/02/2018 13:28:41
Soy novato, paso a paso voy sacando adelante el proyecto, pero... Lo que me funciona en el otro formulario del proyecto (con otro nombre la instancia de webbrowser (allí se llama simplemente Browser en este formulario no funciona. Podeís echarme un cable?
Agradecido de antemano
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Imports System.IO
Public Class Renovar
Private Sub MovForm_Click(sender As Object, e As EventArgs) Handles MovForm.Click
Dim a As New Login
a.Show()
Me.Finalize()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Renovar1.Click
Dim path As String = "C:\texto.txt"
Dim readText As String() = File.ReadAllLines(path)
Dim lelementos As HtmlElementCollection = BrowserRen.Document.All (Aqui me da el error System.NullReferenceException: 'Object reference not set to an instance of an object.')
For Each s As String In readText
BrowserRen.Navigate(s)
For Each lelemento As HtmlElement In lelementos
If lelemento.GetAttribute("id") = "lren" Then
lelemento.InvokeMember("click")
End If
Next
Next
End Sub
End Class
Valora esta pregunta


0