なぜこの例外が発生するのですか?
オブジェクト参照がオブジェクト インスタンスに設定されていません。
と:
wb.Document.GetElementById("formfieldv1").InnerText = "some value"
コントロールwb
の名前はどこにありますか。WebBrowser
すべてのコードは次のとおりです。
Private Sub btnSend_Click(sender As System.Object, e As System.EventArgs) Handles btnSend.Click
Dim strFrom As String = txtFrom.Text
Dim strTo As String = txtTo.Text
Dim strMsg As String = txtMsg.Text
wb.Document.GetElementById("formfieldv1").InnerText = strFrom ' strFrom fills fine
End Sub
アップデート
コメントで示唆されているように、私は次のようにコードを変更しました:
Dim doc = wb.Document
If (doc Is Nothing) Then
MsgBox("doc is nothing")
End If
Dim el = wb.Document.GetElementById("formfieldv1")
If (el Is Nothing) Then
MsgBox("el is nothing")
Else
el.InnerText = strFrom
End If
それで私は得ていel is nothing
ます。これを今解決するにはどうすればよいですか?
あるいは、皆さんがこれで私を助けてくれるなら、それは私の問題も解決します: