We help IT Professionals succeed at work.
Get Started

I need help converting some vb.net code to C#.net code

JDL129
JDL129 asked
on
850 Views
Last Modified: 2012-05-11
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:

Comment
Watch Question
.Net Full Stack Developer
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE