Control.Invoke Method (Delegate) vb.net
פארעפענטליכט: פרייטאג יוני 22, 2012 1:55 pm
- קאוד:
Function openMikve() As String
Try
Dim wb As WebBrowser
wb = Me.WebBrowser1
Dim elmnt As Object
elmnt = wb.Document.GetElementById("pb2").Children
For Each iHTMLEle In elmnt
iHTMLEle.InvokeMember("click")
Next
Return "Open"
Catch ex As Exception
Return ex.ToString()
End Try
End Function
די אויבן דערמאנטע פונקשען ארבעט פיין ווען איך רוף עס פון א באטטאן אויפן פארם
אבער ווען איך רוף עס דורך גוגל טאלק באקום איך די ערארר
- קאוד:
System.InvalidCastException: Specified cast is not valid.
at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
at System.Windows.Forms.WebBrowser.get_Document()
אויף די ליין אויף קאוד געשעט די ערראר
- קאוד:
elmnt = wb.Document.GetElementById("pb2").Children
ליבי אומר לי אז די פראבלעם איז אז מען דארף ניצן invoke ווען א אויטסיידער וויל טשעפען א קאנטראל פון די פארם
כדאי צי אראפנעמען א טשעק פון א טשעקבאקס פון די פארם האב איך געמוזט ניצן די קאוד
- קאוד:
Public Sub resetChk(ByVal item As String)
Dim chkb As CheckBox
chkb = CType(Me.Controls.Item("CheckBox" & item), CheckBox)
If chkb.InvokeRequired Then
chkb.Invoke(New CheckBoxItemDelegate(AddressOf CheckBoxItem), item)
'chkb.Checked = True
End If
End Sub
וואס דארף איך יעצט שרייבן און די פאל?