|
Rank: Newbie Groups: Member
Joined: 12/26/2021 Posts: 6
|
when I used webview1.evalscript inside webview1_click the project stop working can any one help me plz
|
|
Rank: Newbie Groups: Member
Joined: 12/26/2021 Posts: 6
|
i used vb.net winform visual basic
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
This is to prevent JavaScript engine from being re-entered. Please use WebView.QueueScriptCall instead.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 12/26/2021 Posts: 6
|
so how to return value from input in webpage using WebView.QueueScriptCall example:TxtFirtName.Text = WebView1.EvalScript("document.getElementById('pt1:r1:0:it2::content').innerText ;")
thanks alot
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, You would do it like this:
Code: Visual Basic.NET
Dim scriptCall = webView.QueueScriptCall("document.getElementById('pt1:r1:0:it2::content').innerText")
scriptCall.OnDone(Function()
MessageBox.Show(scriptCall.Result.ToString())
End Function)
Note that inside the OnDone callback you use scriptCall.Result to access the result. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 12/26/2021 Posts: 6
|
hi it is not working there is error in the code
if you can help me please
thanks alot
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
The sample code is only to show you the idea. You will have to understand the code, adapt it to fit your need, and debug it if you run into any problem. You can't just say "it's not working" and expecting us to fix it for you. If you wish us to look into an error for you, you will need to at least explain what error you are running into and why you believe this error needs to be resolved on our end. For simple compiler errors or logical code errors, you will need to resolve those yourself.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 12/26/2021 Posts: 6
|
hi i try c# code like this var scriptcall = webView1.QueueScriptCall("document.getElementById('email').value"); scriptcall.OnDone(() => { MessageBox.Show(scriptcall.Result.ToString()); //code to be called when done }); and it is working but i need it in vb so inside ondone(this syntax not working) i try to write code inside ondone() in defferent ways but it not working alwayes error error msg Severity Code Description Project File Line Suppression State Error BC30521 Overload resolution failed because no accessible 'OnDone' is most specific for these arguments: 'Public Overloads Sub OnDone(action As Action)': Not most specific. 'Public Overloads Sub OnDone(action As Action(Of WaitableTask))': Not most specific. WindowsApp1 C:\Users\basim\source\repos\WindowsApp1\WindowsApp1\Form1.vb 45 Active
thans alot
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi, Please change Function to Sub:
Code: Visual Basic.NET
Dim scriptCall = webView.QueueScriptCall("document.getElementById('pt1:r1:0:it2::content').innerText")
scriptCall.OnDone(Sub()
MessageBox.Show(scriptCall.Result.ToString())
End Sub)
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 12/26/2021 Posts: 6
|
hi its working well thanks alot alot alot
|
|