jesper

jesper

  • NA
  • 89
  • 54.2k

Convert vb to c#

Nov 9 2012 9:19 AM
i will like to ask if anyone can convert this simple vb script to c#  :i  im a beginner so it would be nice to have an example.

strComputer = "."  Set objWMIService = GetObject("winmgmts:" _   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")    Set objNewPort = objWMIService.Get _   ("Win32_TCPIPPrinterPort").SpawnInstance_    objNewPort.Name = "IP_10.10.10.113"  objNewPort.Protocol = 1  objNewPort.HostAddress = "10.10.10.113"  objNewPort.PortNumber = "9100"  objNewPort.SNMPEnabled = False  objNewPort.Put_    Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_    objPrinter.DriverName = "HP LaserJet 4000 Series PS"  objPrinter.PortName = "IP_10.10.10.113"  objPrinter.DeviceID = "FrontOffice"  objPrinter.Network = True  objPrinter.Put_ 
//Thanks :)

Answers (5)