I need to change this to C# and I need to know where to put it.
Public WithEvents UPED As New SIM.Charge
Is this the correct translation?
SIM.Charge UPED = new SIM.Charge();
When I run the code I get the error message below but the SIM.dll is in the path specified by the properties of the dll.
System.IO.FileNotFoundException was unhandled
Message="Could not load file or assembly 'Hid.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=784515207d9cd9fa' or one of its dependencies. The system cannot find the file specified."
Source="SIM"
FileName="Hid.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=784515207d9cd9fa"
FusionLog="=== Pre-bind state information ===\r\nLOG: User = CAKPOSSERVER\\Jerry\r\nLOG: DisplayName = Hid.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=784515207d9cd9fa\n (Fully-specified)\r\nLOG: Appbase = file:///C:/POSiTrackC19/POSiTrackC/POSiTrackC/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : SIM, Version=2.0.3.5, Culture=neutral, PublicKeyToken=5456cc89cbcb6145.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: Using application configuration file: C:\\POSiTrackC19\\POSiTrackC\\POSiTrackC\\bin\\Debug\\POSiTrackC.vshost.exe.Config\r\nLOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: Hid.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=784515207d9cd9fa\r\nLOG: Attempting download of new URL file:///C:/POSiTrackC19/POSiTrackC/POSiTrackC/bin/Debug/Hid.Net.DLL.\r\nLOG: Attempting download of new URL file:///C:/POSiTrackC19/POSiTrackC/POSiTrackC/bin/Debug/Hid.Net/Hid.Net.DLL.\r\nLOG: Attempting download of new URL file:///C:/POSiTrackC19/POSiTrackC/POSiTrackC/bin/Debug/Hid.Net.EXE.\r\nLOG: Attempting download of new URL file:///C:/POSiTrackC19/POSiTrackC/POSiTrackC/bin/Debug/Hid.Net/Hid.Net.EXE.\r\n"
StackTrace:
at SIM.USB_HID_Driver.USBInterface..ctor()
at SIM.USB_HID..ctor()
at SIM.Charge..ctor()
at POSiTrackC.frmCCMX..ctor() in C:\POSiTrackC19\POSiTrackC\POSiTrackC\frmCCMX.cs:line 15
at POSiTrackC.frmEntry.btnCreditCard_Click(Object sender, EventArgs e) in C:\POSiTrackC19\POSiTrackC\POSiTrackC\frmEntry.cs:line 1020
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at POSiTrackC.Program.Main() in C:\POSiTrackC19\POSiTrackC\POSiTrackC\Program.cs:line 27
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Your C# code to declare and instantiate the SIM.Charge object is correct. That error message would suggest your project is missing a reference - right click on your project, choose Add Reference, and add the DLL containing SIM.Charge to your project.