|
I'm trying to wait till the page is loaded and then execute JavaScript but all my attempts are "failing" (its working with a timer).
So far i tried
If Browser.CanExecuteJavascriptInMainFrame Then
End If or
If Browser.IsLoading Then
End If Right now im using a timer to do it.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Browser = New ChromiumWebBrowser("https://example.com")
Form1.Panel1.Controls.Add(Browser)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If Browser.IsLoading = True Then
Debug.WriteLine("true")
Else
Dim test As Task(Of JavascriptResponse) = Browser.EvaluateScriptAsync("document.getElementsByTagName('h1')[0].innerText")
Debug.WriteLine(test.Result.Result)
Timer1.Enabled = False
End If
End Sub
but this way it feels just like bad coding and i don't want to do this. Every time i try it another way it will just try it once as its not a loop(tried a loop and i failed as well )
I read the general usage of CefSharp but the problem here is everything is in C# i do understand it but i cant convert it to vb cause my knowledge isn't that great.
|
|
|
|
|
Hi everyone,
In my Gizmox Webgui application (vb code) I have: "Form1" containing an "HtmlBox1" control
In the form I have the following function:
<pre lang="text"></pre>
<PermissionSet (SecurityAction.Demand, Name: = "FullTrust")> _
<System.Runtime.InteropServices.ComVisibleAttribute (True)> _
Public Sub VbHelloWorld ()
MsgBox ("Hello World")
End Sub
In order to call this function from "HtmlBox1.html" I added to the html code of the "HtmlBox1" control the following script:
<script type = 'text / javascript'>
function showVbFunction () {
window.external.VbHelloWorld ();
}
</script>
and the following link:
<body>
<a href='#' onclick='showVbFunction()'> Say Hello World From VB </a>
</body>
When debugging and clicking the link, I get the following error: "window.external.VbHelloWorld is not a function"
The script cannot access the function.
Is there anyone who can help me?
-- modified 22-Oct-20 11:33am.
|
|
|
|
|
This is not the place for technical problems, as it states clearly at teh top of the page.
Post it here:http://www.codeproject.com/Questions/ask.aspx[^] but think first: Remember that we can't see your screen, access your HDD, or read your mind - we only get what you tell us to work from. So write your question based on that!
Explain exactly what you have tried, and where you are stuck. The more accurate you are the better the response.
And please, use the code widget to format your code blocks! It's immediately above the input box you are putting the code in ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hello:
I am trying to connection using old school VBA.
This works in VBA!
connectionString = "Provider=sqloledb;Data Source=w2012;Initial Catalog=M1_SU;User Id=m1view;Password=connect2m1;"
This works in VB.NET, but says the server does not exist or access is denied...
"Provider=sqloledb;Data Source=sage;Initial Catalog=JobSheet;persist security info=True;Integrated Security=SSPI;"
Why would the server be available in VB.NET but not in VBA?
Here's the complete code. I must be missing something..
Sub GetJobs_Click()
Dim connectionString As String
' connectionString = "Provider=sqloledb;Data Source=w2012;Initial Catalog=M1_SU;User Id=m1view;Password=connect2m1;"
connectionString = "Provider=sqloledb;Data Source=sage;Initial Catalog=JobSheet;persist security info=True;Integrated Security=SSPI;"
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim sql As String
sql = "SELECT * From [JobSheet].[dbo].[JobInfo] ORDER BY JobNo "
MsgBox (sql)
cn.connectionString = connectionString
[COLOR="#FF0000"]cn.Open ' ERROR'S HERE[/COLOR]
rs.Open sql, cn, adOpenKeyset, adLockReadOnly, adCmdText
rs.MoveFirst
Do While Not rs.EOF
MsgBox (rs.Fields("JobNo"))
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Thanks!
|
|
|
|
|
"Integrated Security" just means to use the credentials of the account running your code. Unless the SQL Server is setup to accept the users Windows accounts as authentication, Integrated Security won't work.
|
|
|
|
|
Hi All,
I want rating bar in my outlook. I want rating bar to be populated in outlook email which has subject stating Resolved.
So when user select the rating i need reply email back to me can this be done in outlook.
I know this can be done in microsoft forms but i want in outlook email body only
TIA
|
|
|
|
|
Hi sir,
I'm trying to insert datetime value from firebird database into oracle database but got "
ORA-01861: literal does not match format string
i'm using this command :
oracmd.CommandText = "INSERT INTO ASIS.TIMECLOCK_DATA(TD_CARDHOLDER_ID,TD_EVENT_DATE) " & _
" VALUES ('" + IBSSDR.Item("CARDHOLDERID").ToString + "',to_date('" + IBSSDR.Item("EVENTDATE") + "','YYYY-MM-DD HH24:MI:SS'))"
'
When i'm using this command
oracmd.CommandText = "INSERT INTO ASIS.TIMECLOCK_DATA(TD_CARDHOLDER_ID,TD_EVENT_DATE) " & _
" VALUES ('" + IBSSDR.Item("CARDHOLDERID").ToString + "',('" + IBSSDR.Item("EVENTDATE") + "'))"
I got this error :-
ORA-01843: not a valid month
Please anyone can guide me?
Plssss, tq
|
|
|
|
|
|
Did you look at the debug/watch window to see how the SQl text contained in oracmd.CommandText looks like?
Did you try to test this SQL expression in the Oracle DB?
|
|
|
|
|
I don't know Oracle so can only assume your date format string is correct; but:
to_date('" + IBSSDR.Item("EVENTDATE") + "','YYYY-MM-DD HH24:MI:SS') is taking a (presumably) date object IBSSDR.Item("EventDate") and putting it directly into that function via string concatenation. As usual, put breakpoints in place and inspect the value of .CommandText - this will show you how VB has formatted that date field, using its default (local) formatting, as input to the function.
You will most likely need to use some explicit formatting on the VB side to create a string that Oracle will be able to parse into a date.
But, as Richard always says, don't build your SQL by string concatenation - parameterise it.
|
|
|
|
|
ooooo i get it, already try to other database like SQL db it can work... maybe oracle have restricted....thank you for idea
|
|
|
|
|
Ok sir thank for the idea it's done by this
<pre> Dim touch As String = DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt")
touch = ("" & IBSSDR.Item("EVENTDATE").ToString & "")
oracmd.CommandText = "INSERT INTO ASIS.TIMECLOCK_DATA(TD_CARDHOLDER_ID,TD_EVENT_DATE,TD_FIRST_IN,TD_IN_READER,TD_IP_CONTROLLER,TD_TYPE) " & _
" VALUES ('" & IBSSDR.Item("CARDHOLDERID") & "',TO_DATE('" & touch & "','dd/mm/yyyy hh:mi:ss am')," & _
"TO_DATE('" & touch & "','dd/mm/yyyy hh:mi:ss am'),'" & IBSSDR.Item("DEVICEID") & "','" & IBSSDR.Item("WINSOCKIPADDRESS") & "','CHECKIN') "
Thank you for yuor help 
|
|
|
|
|
|
Hi Sir,
I'm try to use Parameter but got this error :
Failed to convert parameter value from a String to a DateTime.
My coding like this :
<pre> oracmd.CommandText = " INSERT INTO ASIS.TIMECLOCK_DATE(TD_CARDHOLDER_ID,TD_EVENT_DATE,TD_FIRST_IN,TD_IN_READER,TD_IP_CONTROLLER,TD_TYPE) " & _
" VALUES (@CARDHOLDERID,(@EVENTDATE),(@FIRSTIN),@READER,@IP,@TYPE)"
oracmd.Parameters.Add("@CARDHOLDERID", OracleType.VarChar).Value = "" & IBSSDR.Item("ID") & ""
oracmd.Parameters.Add("@EVENTDATE", OracleType.DateTime).Value = "TO_DATE('06/10/2020 09:30:00','dd/mm/yyyy hh:mi:ss am')"
oracmd.Parameters.Add("@FIRSTIN", OracleType.DateTime).Value = "TO_DATE('06/10/2020 09:30:00','dd/mm/yyyy hh:mi:ss am')"
oracmd.Parameters.Add("@READER", OracleType.VarChar).Value = "" & IBSSDR.Item("DEVICE_ID") & ""
oracmd.Parameters.Add("@TYPE", OracleType.VarChar).Value = "CHECKIN"
oracmd.CommandType = CommandType.Text
My oracle using format like this : dd/mm/yyyy hh:mi:ss am'
anyone got idea to hlep me?..Plzz
|
|
|
|
|
Why are you converting all of your parameter values to strings? Use the appropriate .NET type instead:
oracmd.CommandText = " INSERT INTO ASIS.TIMECLOCK_DATE(TD_CARDHOLDER_ID,TD_EVENT_DATE,TD_FIRST_IN,TD_IN_READER,TD_IP_CONTROLLER,TD_TYPE) " & _
" VALUES (@CARDHOLDERID, @EVENTDATE, @FIRSTIN, @READER, @IP, @TYPE)"
oracmd.Parameters.Add("@CARDHOLDERID", OracleType.VarChar).Value = IBSSDR.Item("ID")
oracmd.Parameters.Add("@EVENTDATE", OracleType.DateTime).Value = New DateTime(2020, 10, 6, 9, 30, 0)
oracmd.Parameters.Add("@FIRSTIN", OracleType.DateTime).Value = New DateTime(2020, 10, 6, 9, 30, 0)
oracmd.Parameters.Add("@READER", OracleType.VarChar).Value = IBSSDR.Item("DEVICE_ID")
oracmd.Parameters.Add("@TYPE", OracleType.VarChar).Value = "CHECKIN"
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Sir,
The datetime value is taking form another database (Firebird) using Datareader(IBSDDR.item("")), so i don't need to convert to_date when insert into ORacle sir?...Plz guide me, thanks in advanced 
|
|
|
|
|
DateTime values do not have a format while stored in the database.
The format is only applied when the value is displayed, either by the query tool you're using to test the query or by your own application. There is no format when stored by the database and that's what's tripping you up.
|
|
|
|
|
Hi Sir
When i'm using Parameter got this error :-
ORA-01008: not all variables bound
Can u advise me what wrong..
<pre> oracmd.CommandText = " INSERT INTO ASIS.TIMECLOCK_DATE(TD_CARDHOLDER_ID,TD_EVENT_DATE,TD_FIRST_IN,TD_IN_READER,TD_IP_CONTROLLER,TD_TYPE) " & _
" VALUES (:CARDHOLDERID,to_date(:EVENTDATE,'dd/mm/yyyy hh:mi:ss am'),to_date(:FIRSTIN,'dd/mm/yyyy hh:mi:ss am'),:READER,:IP,:TYPE)"
<pre>oracmd.Parameters.Add(":CARDHOLDERID", OracleType.VarChar).Value = "" & IBSSDR.Item("ID") & ""
oracmd.Parameters.Add(":EVENTDATE", OracleType.DateTime).Value = ("" & IBSSDR.Item("EVENT_DATE").ToString & "")
oracmd.Parameters.Add(":FIRSTIN", OracleType.DateTime).Value = ("" & IBSSDR.Item("EVENT_DATE").ToString & "")
oracmd.Parameters.Add(":READER", OracleType.VarChar).Value = "" & IBSSDR.Item("DEVICE_ID") & ""
oracmd.Parameters.Add(":TYPE", OracleType.VarChar).Value = "CHECKIN"
oracmd.CommandType = CommandType.Text
...thank you
|
|
|
|
|
You're trying to convert date strings being passed to the parameters to date values in the SQL VALUES clause. Don't do that because all you have to do is pass in DateTime values WITHOUT using "to_date" in the SQL.
And what's with the "" & garbage? Get rid of stuff. It's useless, unless you want to make the code harder to read and debug.
oracmd.CommandText = " INSERT INTO ASIS.TIMECLOCK_DATE(TD_CARDHOLDER_ID,TD_EVENT_DATE,TD_FIRST_IN,TD_IN_READER,TD_IP_CONTROLLER,TD_TYPE) " & _
" VALUES (:CARDHOLDERID, :EVENTDATE, :FIRSTIN, :READER, :IP, :TYPE)"
oracmd.Parameters.Add(":CARDHOLDERID", OracleType.VarChar).Value = IBSSDR.Item("ID") oracmd.Parameters.Add(":EVENTDATE", OracleType.DateTime).Value = IBSSDR.Item("EVENT_DATE")
oracmd.Parameters.Add(":FIRSTIN", OracleType.DateTime).Value = IBSSDR.Item("EVENT_DATE")
oracmd.Parameters.Add(":READER", OracleType.VarChar).Value = IBSSDR.Item("DEVICE_ID")
oracmd.Parameters.Add(":TYPE", OracleType.VarChar).Value = "CHECKIN"
|
|
|
|
|
Sir,
The datetime value is taking form another database (Firebird) using Datareader(IBSDDR.item("")), so i don't need to convert to_date when insert into ORacle sir?...Plz guide me, thanks in advanced Smile | :)
|
|
|
|
|
OK, one last time. THERE IS NO SUCH THING AS A FORMAT FOR A DATETIME VALUE IN A DATABASE.
ALWAYS use parameters to pass values into a query string.
NEVER use string concatenation to build SQL queries.
|
|
|
|
|
Where is the
oracmd.Parameters.Add(":IP", ...) 
|
|
|
|
|
As others have said, avoid string concatenation, use parameterised queries (which in this instance would also avoid all the date formatting).
Your thanks and confirming you've got the code working is appreciated! 
|
|
|
|
|
Thank you for advised. 
|
|
|
|
|
Sorry, this always seems to happen after I post but I think I get it now. I'm trying to assign a value to a class. It compiles if i do this:
Private Sub ab(Optional ByVal val As EncryptKey = Nothing)
end Sub
I was confused by this:
Private Sub ab(Optional ByVal val As String = "")
end Sub
I don't know how String is defined to be able to accept this but what I'm doing won't work.
Sorry again for the ugly post.
Sorry about the subject line; didn't know how to describe my problem.
Through searching around the internet i've come up with this class to be able to process a string value.
Class EncryptKey
Private _string As String = String.Empty
Public Sub New(ByVal value As String)
' Remove white space
Me._string = value.Trim()
End Sub
Public Shared Widening Operator CType(ByVal value As String) As EncryptKey
Return New EncryptKey(value)
End Operator
Public Overrides Function ToString() As String
Return _string
End Function
Public Function Length() As Integer
Return Me._string.Length
End Function
Public Function IsEmpty() As Boolean
Return (_string.Length = 0)
End Function
Public Shared Operator +(ByVal s1 As EncryptKey, ByVal s2 As EncryptKey) As EncryptKey
' Concat and remove white space
Dim temp As String = (s1._string + s2._string).Trim()
Return New EncryptKey(temp)
End Operator
End Class
The class is working except for this case:
Private Sub ab(Optional ByVal val As EncryptKey = "")
' Results in this error for the Optional assigment:
'error BC30060: Conversion from 'String' to 'EncryptKey' cannot occur in a constant expression.
End Sub
Is there a way to make the class able to accept this assignment as an Optional parameter?
Thank you
-- modified 30-Sep-20 12:34pm.
|
|
|
|
|