Namespace SimplePrinter Module TestSimplePrinter Sub Main() '--------------------------------------------------------- ' TestSimplePrinter.A: create a new printer object '--------------------------------------------------------- Dim myPrinter As Printer = New Printer(Printer.PrinterEnum.Laser, _ Printer.AttachmentEnum.LAN Or _ Printer.AttachmentEnum.Parallel Or _ Printer.AttachmentEnum.USB) '--------------------------------------------------------- ' TestSimplePrinter.B: test for the printer type '--------------------------------------------------------- Select Case myPrinter.Type Case Printer.PrinterEnum.DotMatrix Console.WriteLine("Uses printer ribbons") Case Printer.PrinterEnum.Inkjet Console.WriteLine("Uses ink cartridges") Case Printer.PrinterEnum.Laser Console.WriteLine("Uses toner cartridges") Case Printer.PrinterEnum.Line Console.WriteLine("Use 1403-style ribbons") Case Printer.PrinterEnum.Thermal Console.WriteLine("Uses special paper") Case Else Console.WriteLine("Other type of printer") End Select '--------------------------------------------------------- ' TestSimplePrinter.C: test for the attachment type(s) '--------------------------------------------------------- If ((myPrinter.Attachment And Printer.AttachmentEnum.BlueTooth) <> 0) Then Console.WriteLine("Supports Bluetooth") End If If ((myPrinter.Attachment And Printer.AttachmentEnum.LAN) <> 0) Then Console.WriteLine("Supports LAN") End If If ((myPrinter.Attachment And Printer.AttachmentEnum.Parallel) <> 0) Then Console.WriteLine("Supports Parallel") End If If ((myPrinter.Attachment And Printer.AttachmentEnum.USB) <> 0) Then Console.WriteLine("Supports USB") End If If (myPrinter.Attachment = 0) Then Console.WriteLine("Supports [unknown]") End If Console.ReadLine() End Sub End Module End Namespace