INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
Favorite Forums
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Feedback
"...I can't start my day without this site!..."
Geography
Where in the world do Tek-Tips members come from?
|
Visual Basic(Microsoft): Version 5 & 6 FAQ
|
What VB shoud be able to do!
|
Printer Select Dialog Form -- Part 3A
Posted: 20 May 03 (Edited 9 Oct 03)
|
Save as PrintSel.frm ÿ VERSION 5.00 Begin VB.Form frmPrinterSelect BorderStyle = 3 'Fixed Dialog Caption = "Printer Select" ClientHeight = 4035 ClientLeft = 2760 ClientTop = 3750 ClientWidth = 6870 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 4035 ScaleWidth = 6870 ShowInTaskbar = 0 'False Visible = 0 'False Begin VB.Frame fraPrinterSelect Caption = " Orientation " Height = 1215 Index = 2 Left = 4800 TabIndex = 4 Top = 2280 Width = 1935 Begin VB.OptionButton optPrinterSelect Caption = "L&andscape" Height = 255 Index = 1 Left = 360 TabIndex = 20 Top = 740 Width = 1215 End Begin VB.OptionButton optPrinterSelect Caption = "P&ortrait" Height = 255 Index = 0 Left = 360 TabIndex = 19 Top = 320 Value = -1 'True Width = 1215 End End Begin VB.Frame fraPrinterSelect Caption = " Paper " Height = 1215 Index = 1 Left = 120 TabIndex = 3 Top = 2280 Width = 4575 Begin VB.ComboBox cboPrinterSelect Height = 315 Index = 2 Left = 1200 Style = 2 'Dropdown List TabIndex = 18 Top = 720 Width = 3135 End Begin VB.ComboBox cboPrinterSelect Height = 315 Index = 1 Left = 1200 Style = 2 'Dropdown List TabIndex = 17 Top = 240 Width = 3135 End Begin VB.Label lblPrinterSelect Caption = "Source:" Height = 255 Index = 10 Left = 240 TabIndex = 16 Top = 740 Width = 855 End Begin VB.Label lblPrinterSelect Caption = "Size:" Height = 255 Index = 9 Left = 240 TabIndex = 15 Top = 320 Width = 855 End End Begin VB.Frame fraPrinterSelect Caption = " Printer " Height = 2055 Index = 0 Left = 120 TabIndex = 2 Top = 120 Width = 6615 Begin VB.ComboBox cboPrinterSelect Height = 315 Index = 0 Left = 1200 Style = 2 'Dropdown List TabIndex = 10 Top = 200 Width = 3135 End Begin VB.Label lblPrinterSelect Height = 255 Index = 8 Left = 1200 TabIndex = 14 Top = 1680 Width = 3135 End Begin VB.Label lblPrinterSelect Height = 255 Index = 7 Left = 1200 TabIndex = 13 Top = 1320 Width = 3135 End Begin VB.Label lblPrinterSelect Height = 255 Index = 6 Left = 1200 TabIndex = 12 Top = 960 Width = 3135 End Begin VB.Label lblPrinterSelect Height = 255 Index = 5 Left = 1200 TabIndex = 11 Top = 600 Width = 3135 End Begin VB.Label lblPrinterSelect Caption = "Comment:" Height = 255 Index = 4 Left = 240 TabIndex = 9 Top = 1680 Width = 855 End Begin VB.Label lblPrinterSelect Caption = "Where:" Height = 255 Index = 3 Left = 240 TabIndex = 8 Top = 1320 Width = 855 End Begin VB.Label lblPrinterSelect Caption = "Type:" Height = 255 Index = 2 Left = 240 TabIndex = 7 Top = 960 Width = 855 End Begin VB.Label lblPrinterSelect Caption = "Status:" Height = 255 Index = 1 Left = 240 TabIndex = 6 Top = 600 Width = 855 End Begin VB.Label lblPrinterSelect Caption = "&Name:" Height = 255 Index = 0 Left = 240 TabIndex = 5 Top = 240 Width = 855 End End Begin VB.CommandButton CancelButton Caption = "Cancel" Height = 375 Left = 5520 TabIndex = 1 Top = 3600 Width = 1215 End Begin VB.CommandButton OKButton Caption = "OK" Height = 375 Left = 4200 TabIndex = 0 Top = 3600 Width = 1215 End End Attribute VB_Name = "frmPrinterSelect" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False '--------------------------------------------------------------------------------------- ' Module : frmPrinterSelect ' Date : 18 May 2003 ' Author : Cassandra Roads, P. Eng. ' Copyright (c) 2003 Professional Logics Corporation '--------------------------------------------------------------------------------------- Option Explicit
Private m_clsPrtSelect As clsPrintSelect Private m_prtSelectedPrinter As Printer Private m_intPortrait As Integer Private m_intPaperSize As Integer Private m_intPaperSizes() As Integer Private m_apiPaperSizes() As POINTAPI Private m_intPaperBin As Integer Private m_intPaperBins() As Integer Private m_blnInProcess As Boolean '
' '---------------------------------------------------------------------------------------- ' PROPERTIES '---------------------------------------------------------------------------------------- ' '--------------------------------------------------------------------------------------- ' Procedure : SelectedPrinter ' Date : 18 May 2003 ' Author : Cassandra Roads, P. Eng. ' Copyright (c) 2003 Professional Logics Corporation '--------------------------------------------------------------------------------------- ' Friend Property Get SelectedPrinter() As Printer Set SelectedPrinter = m_prtSelectedPrinter End Property ' '---------------------------------------------------------------------------------------- '
'--------------------------------------------------------------------------------------- ' Procedure : PrintSelect ' Date : 18 May 2003 ' Author : Cassandra Roads, P. Eng. ' Copyright (c) 2003 Professional Logics Corporation '--------------------------------------------------------------------------------------- ' Friend Property Set PrintSelectCls(ByRef clsNewPS As clsPrintSelect) If IsNull(clsNewPS) Then Exit Property If clsNewPS Is Nothing Then Exit Property Set m_clsPrtSelect = clsNewPS End Property ' '---------------------------------------------------------------------------------------- '
'--------------------------------------------------------------------------------------- ' Procedure : CancelButton_Click ' Date : 18 May 2003 ' Author : Cassandra Roads, P. Eng. ' Copyright (c) 2003 Professional Logics Corporation '--------------------------------------------------------------------------------------- ' Private Sub CancelButton_Click() Me.Hide End Sub ' '---------------------------------------------------------------------------------------- '
'--------------------------------------------------------------------------------------- ' Procedure : cboPrinterSelect_Click ' Date : 18 May 2003 ' Author : Cassandra Roads, P. Eng. ' Copyright (c) 2003 Professional Logics Corporation '--------------------------------------------------------------------------------------- ' Private Sub cboPrinterSelect_Click(Index As Integer) ' If we are in a process and the combobox routine is not to run, then exit. ' Set up the error handler. ' If the printer select combobox has been altered, then ' Get a pointer to the selected printer, by scanning the Printers object. ' Populate the other two comboboxes based on the selected printer. ' Obtain and display the selected printer's stati. ' Elseif the PaperSize combobox has been altered, then ' Pick up the PaperSize index for the selected paper size. ' Tell the Report Generator module the PaperSize index. ' Tell the selected printer which PaperSize index to change to. ' Elseif the PaperBin combobox has been altered, then ' Pick up the PaperBin index for the selected paper bin. ' Tell the Report Generator module the PaperBin index. ' Tell the selected printer which PaperBin index to change to. '------------------------------------------------------------------------------------ ' Dim prtX As Printer, I As Integer, strTemp As String, strPrinterName As String Dim strPrinterType As String, strPrinterStatus As String, strPortName As String Dim strComment As String If m_blnInProcess Then Exit Sub Else m_blnInProcess = True End If ' On Error GoTo cboPrinterSelect_Click_Error ' strTemp = m_prtSelectedPrinter.DeviceName ' If Index = 0 Then ' Printer Selection CBO ' For Each prtX In Printers If prtX.DeviceName = cboPrinterSelect(0).Text Then Set m_clsPrtSelect.SelectedPrinter = prtX Set m_prtSelectedPrinter = prtX Exit For End If Next prtX ' Call PopulatePaperCBOs If GetPrinterStati(m_prtSelectedPrinter.DeviceName, strPrinterType, _ strPrinterStatus, strPortName, strComment) Then strTemp = "" If m_prtSelectedPrinter.DeviceName = Printer.DeviceName Then strTemp = "Default printer; " End If lblPrinterSelect(5).Caption = strTemp & strPrinterStatus If Len(strPrinterType) > 0 Then lblPrinterSelect(6).Caption = strPrinterType Else lblPrinterSelect(6).Caption = m_prtSelectedPrinter.DeviceName End If lblPrinterSelect(7).Caption = strPortName lblPrinterSelect(8).Caption = strComment End If ' ElseIf Index = 1 Then ' Paper Size CBO I = m_intPaperSizes(cboPrinterSelect(1).ListIndex + 1) Call SetPrinterProperty(m_prtSelectedPrinter.DeviceName, DM_PAPERSIZE, I) ElseIf Index = 2 Then ' Paper Source CBO I = m_intPaperBins(cboPrinterSelect(2).ListIndex + 1) Call SetPrinterProperty(m_prtSelectedPrinter.DeviceName, DM_DEFAULTSOURCE, I) End If m_blnInProcess = False On Error GoTo 0 Exit Sub cboPrinterSelect_Click_Error: Debug.Print "frmPrinterSelect : cboPrinterSelect_Click :: " & Err.Number & " : " & _ Err.Description Err.Clear On Error GoTo 0 End Sub ' '---------------------------------------------------------------------------------------- ' ' ÿ Continued in Part 3B
|
Back to Visual Basic(Microsoft): Version 5 & 6 FAQ Index
Back to Visual Basic(Microsoft): Version 5 & 6 Forum |
|
 |
|
Join Tek-Tips® Today!
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More...
Register now while it's still free!
Already a member? Close this window and log in.
Join Us Close