Click here to Skip to main content
15,899,475 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: this code Pin
albertodiprima18-Jul-11 8:59
albertodiprima18-Jul-11 8:59 
GeneralRe: this code Pin
albertodiprima15-Jul-11 17:25
albertodiprima15-Jul-11 17:25 
GeneralRe: this code Pin
Richard MacCutchan15-Jul-11 22:43
mveRichard MacCutchan15-Jul-11 22:43 
GeneralRe: this code Pin
albertodiprima16-Jul-11 8:14
albertodiprima16-Jul-11 8:14 
GeneralRe: this code Pin
albertodiprima16-Jul-11 8:27
albertodiprima16-Jul-11 8:27 
QuestionPrinting Function on Windows 7 Professional 64-bit not working Pin
Dominick Marciano13-Jul-11 10:58
professionalDominick Marciano13-Jul-11 10:58 
AnswerRe: Printing Function on Windows 7 Professional 64-bit not working Pin
Richard MacCutchan13-Jul-11 22:05
mveRichard MacCutchan13-Jul-11 22:05 
GeneralRe: Printing Function on Windows 7 Professional 64-bit not working Pin
Dominick Marciano27-Jul-11 10:00
professionalDominick Marciano27-Jul-11 10:00 
I've added a Try-Catch block around this section of code. The full block now looks like this:

Try
      OriginalPrinter = PrintDB.PrinterSettings.PrinterName
      If PrintDB.ShowDialog() = Windows.Forms.DialogResult.OK Then
            PSettings = PrintDB.PrinterSettings
            NewPrinter = PrintDB.PrinterSettings.PrinterName
            wshNetwork = Microsoft.VisualBasic.CreateObject("WScript.Network")
            wshNetwork.SetDefaultPrinter(NewPrinter)
            Report.Print(PSettings)
            wshNetwork.setDefaultPrinter(OriginalPrinter)
      End If
Catch ex As Exception
      MessageBox.Show("An error occurred while trying to print.  If this problem persist please contact the system administrator.", "Printing", MessageBoxButtons.OK, MessageBoxIcon.Error)
      LogError(ex, "frmMain", "CreateRecordDocument")
End Try


The LogError function writes any errors to the Windows EventViewer. I left the catch block to catch all exceptions because I don't know why this code is not executing. I tried it several times on the Win7 computer it is not working on and all the code previous to this block executes fine, however the document does not print. What is even weirder is that no exception is thrown and nothing is written to the EventViewer. Is there some change with Microsoft.VisualBasic.CreateObject("WScript.Network") between Windows XP and Windows 7, or 32-bit vs. 64-bit. If so, is there a relatively simple work around?

Thanks.
GeneralRe: Printing Function on Windows 7 Professional 64-bit not working Pin
Richard MacCutchan27-Jul-11 22:07
mveRichard MacCutchan27-Jul-11 22:07 
QuestionDLLs and Compiler Directives Pin
TheComputerMan13-Jul-11 0:46
TheComputerMan13-Jul-11 0:46 
AnswerRe: DLLs and Compiler Directives Pin
Shameel13-Jul-11 2:26
professionalShameel13-Jul-11 2:26 
GeneralRe: DLLs and Compiler Directives Pin
TheComputerMan13-Jul-11 2:29
TheComputerMan13-Jul-11 2:29 
GeneralRe: DLLs and Compiler Directives Pin
Shameel13-Jul-11 21:48
professionalShameel13-Jul-11 21:48 
GeneralRe: DLLs and Compiler Directives Pin
TheComputerMan14-Jul-11 2:13
TheComputerMan14-Jul-11 2:13 
GeneralRe: DLLs and Compiler Directives Pin
Shameel14-Jul-11 3:51
professionalShameel14-Jul-11 3:51 
QuestionDate problem Pin
hang_em13-Jul-11 0:34
hang_em13-Jul-11 0:34 
AnswerRe: Date problem Pin
TheComputerMan13-Jul-11 1:04
TheComputerMan13-Jul-11 1:04 
AnswerRe: Date problem Pin
Dave Kreskowiak13-Jul-11 6:20
mveDave Kreskowiak13-Jul-11 6:20 
AnswerRe: Date problem Pin
sripchowdhury16-Jul-11 0:26
sripchowdhury16-Jul-11 0:26 
AnswerRe: Date problem Pin
Bernhard Hiller19-Jul-11 0:47
Bernhard Hiller19-Jul-11 0:47 
GeneralRe: Date problem Pin
hang_em19-Jul-11 18:09
hang_em19-Jul-11 18:09 
QuestionGraph on Windows Forms (VB) Pin
geekgautam10-Jul-11 23:28
geekgautam10-Jul-11 23:28 
AnswerRe: Graph on Windows Forms (VB) Pin
Dave Kreskowiak11-Jul-11 1:08
mveDave Kreskowiak11-Jul-11 1:08 
SuggestionMessage Removed Pin
12-Jul-11 2:49
Tmoshea12-Jul-11 2:49 
GeneralRe: Graph on Windows Forms (VB) Pin
Dave Kreskowiak12-Jul-11 3:44
mveDave Kreskowiak12-Jul-11 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.