I want to return the text of a textbox. This worked. But calling the function with the before determined parameter cause an InvalidCastException. Visual Studio says that converting from IAsyncResult to FileInfo (searchEnginePower returns this) could cause runtime errors.
Dim result As IAsyncResult = Me.BeginInvoke(Function() As String
Return PropABCtool.PropTextbox1
End Function)
Dim a As FileInfo = Me.BeginInvoke(Sub() PropABCtool_.PropCar.searchEnginePower(Me.EndInvoke(result)))
If a IsNot Nothing And a.Exists Then
...
End If
How can I solve the exception?
You haven't really provided all the relevant information but, from what I can tell, you should be doing this: