I can't figure out what these errors means:
"Reference to a non-shared member requires an object reference" (Shown below in bold)
"SendKeys' is ambiguous, imported from the namespaces or types 'System.Windows.Forms, Microsoft.VisualBasic.Devices.Keyboard" (Shown below in underline)
I've tried seaching online and all I can find is help files which don't give any examples on how to fix the problem. I am to the point of trying to test this extremely basic code and I can't even get it to work.
I have the references loaded, I have the imports called out up top... I just don't understand and am close to just giving up on VB.net and go back to VBA.
--------------------------------------------------------------
Here is my code:
'Option Settings
Option Strict Off
Option Explicit On
'Default Imports
Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
'Additional Imports
Imports System.Diagnostics.Debug
Imports VBIDE
Imports Microsoft.VisualBasic.Devices.Keyboard
Imports System.Windows.Forms
Partial Class SolidWorksMacro
'Public Variables and Declarations
Public swApp As SldWorks
Public Sub main()
Dim v_String1 As String
v_String1 = "Test String"
Print(v_String1)
ClearImmediateWindow()
End Sub
Public Function ClearImmediateWindow()
On Error Resume Next
Dim winImm As VBIDE.Window
Dim winActive As VBIDE.Window
' set the Window object variable to the Current Window
winActive = VBE.ActiveWindow
' set the Window object variable to the Immediate Window
winImm = VBE.Windows("Immediate")
' Clear
winImm.SetFocus()
SendKeys("^({Home})", True)
SendKeys("^(+({End}))", True)
SendKeys("{Del}", True)
Print(Now)
winImm = Nothing
winActive.SetFocus()
End Function
End Class
--------------------------------------------------------------