1
Public Function GetPrinter(ByVal PrinterID As Guid) As DataSet
Try
GetPrinter = New DataSet
MyBase.SQL = "SelectPrinter"
//Initialize the Command object
MyBase.InitializeCommand()
//Add the Parameter to the Parameters collection
MyBase.AddParameter("@PrinterID", _
SqlDbType.UniqueIdentifier, 16, PrinterID)
//Fill the DataSet
MyBase.FillDataSet(GetPrinter, "Printers")
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Public Function GetPrinter(ByVal PrinterID As Guid) As DataSet
Try
//Call the data component to get a specific Printer
GetPrinter = objPrinterDA.GetPrinter(PrinterID)
Catch ExceptionErr As Exception
Throw New System.Exception(ExceptionErr.Message, _
ExceptionErr.InnerException)
End Try
End Function
Private Sub cboCodeLevelPrinters_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboCodeLevelPrinters.SelectedIndexChanged
//Initialize a new instance of the business logic component
Using objPrinters As New CodeLevelsBusinessLogic.PrintersBL(_
strCompany, strApplication)
Try
//The next line of code throws a "Unrecognozed Guid Format" error message.
//Get the specific Printer selected in the cboCodeLevelPrinters combobox
objDataSet = objPrinters.GetPrinter(_
New Guid(cboCodeLevelPrinters.SelectedText.ToString.ToUpper))
//End error line
//Populate the CodeLevels Location & IPAddress textbox's
txtCodeLevelLocation.Text = (_
objDataSet.Tables("Printers").Rows(0).Item("PrinterLocation"))
txtCodeLevelIPAddress.Text = (_
objDataSet.Tables("Printers").Rows(0).Item("PrinterIPAddress"))
Catch ExceptionErr As Exception
MessageBox.Show(ExceptionErr.Message, strAppTitle)
End Try
End Using
End Sub