Results 1 to 9 of 9

Thread: [RESOLVED] Application hang printing throught the network!!

  1. #1

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Resolved [RESOLVED] Application hang printing throught the network!!

    Hi friends.

    I have 2 printers throught the network each are connected to a print server
    I redirect the printer with .bat file in windows startup

    Print Server 1
    Net Use LPT1 :/DELETE
    Net Use LPT1 :\\192.168.1.1\Printer1

    Print Server 2
    Net Use LPT2 :/DELETE
    Net Use LPT2 :\\192.168.1.2\Printer2

    Sometimes when there is a network like "Request Time Out", when User are going to print the application hang

    I use this code to check printer status but the application hang again

    Code:
    Private Function CheckPrinterStatus(ByVal LPTPort as String) as Boolean
    
    On Local Error GoTo PrinterError:
    
    Select Case LPTPort
    
    Case LPT1:
    
    Open LPT1 For Output #1
    
    Case LPT2:
    
    Open LPT2 For Output #1
    
    end select
    
    Close #1
    
    Exit Function
    
    PrinterError:
           
             Select Case LPTPort
                  
                     Case LPT1:
                         CheckPrinterStatus = True
                        MsgBox "Check Print Server 1"
      
                     Case LPT2:
                         CheckPrinterStatus = True
                        MsgBox "Check Print Server 2"
            
              End Select
             
    End  sub
    Is there is a way to check the print servers throught the network that the application don't hang

    I'll Apreciate a lot if someone can help me.

    Cabral
    I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code

  2. #2

  3. #3

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Application hang printing throught the network!!

    Ok, If I use printer.print the application don't hang?
    Please can you show the code to configure those print server with printer.print?

    Thanks,

    Cabral
    I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Application hang printing throught the network!!

    There is no code - add printer to your computer, set it as default and that's about it.
    If system has multiple printers you may programmatically change default printer and we have samples that handle that already posted.
    VB6 has built-in object - Printer - so when your use Printer.Print command it will send print job to default printer.
    There is also way to loop through printers collection and set Printer object to another printer without actually changing default.
    For samples and other suggestions try searching this forum for something like "printer.print" or "default printer", etc...

  5. #5
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Application hang printing throught the network!!

    Code i use to get a list of printers and highlight the default printer
    Code:
    Dim I As Integer
    Dim p As Printer
    
    On Error GoTo errHandler
    'Printer.DeviceName is the way to get default printer    
      
        For Each p In Printers
         List1.AddItem p.DeviceName
        Next
     For I = 0 To List1.ListCount - 1
      If List1.list(I) = Printer.DeviceName Then
       List1.ListIndex = I
       Exit Sub
      End If
     Next
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  6. #6

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Application hang printing throught the network!!

    I'll Try This!!
    I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code

  7. #7
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Application hang printing throught the network!!

    That will only work if there is at least one printer configured.
    Like I said it only through existing printers and populates listbox control.
    However, it does not add any printers to your system nor it configures it.

  8. #8
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Application hang printing throught the network!!

    Quote Originally Posted by ecabralrojas View Post
    I'll Try This!!
    To determine if there are no printers:
    Dim i as integer

    i = Printers.Count
    If i = 0 then 'no printers configured on the system
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  9. #9

    Thread Starter
    Addicted Member ecabralrojas's Avatar
    Join Date
    Jun 2008
    Location
    Inside SQL Server 2005 and VB.NET 2005
    Posts
    200

    Re: Application hang printing throught the network!!

    It's like it Rhino Said I'll working it

    I Apreciate a lot you help inoend07
    I don't need any books to learn Visual Basic and SQL Server, vbforum.com is the answer to learn SQL and break the code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width