Skip to content

Selected printer as a default printer in windows application

saravana narayanan

Asked Dec 9, 2011, 8:33 PM EST3 answers
Share
LinkedInX
 am using below code to pop up and select the printer in the network.
 
Dim d As New PrintDialog()
dim lsPrinter as string
If d.ShowDialog() = DialogResult.OK Then
      lsPrinter =d.PrinterSettings.PrinterName,
end if
 
Now i would like to set the selected printer as the default printer for this applicaton.how can i do it.

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Senthilkumar
    0
    Hi,

    I am not understanding your requirements.

    Do you want to set the first time selected printer as default for the sub sequent request?


    Thanks,
    Senthil. 
    0
  • 0
    s correct. I need like this only.
    0
  • Senthilkumar
    0
    Hi,

    Then the way of implementation has to be changed.
    Please use the following method. Include the system.drawing.printing

    Code
    foreach (String printer in PrinterSettings.InstalledPrinters)
    {
    printersList.Items.Add (printer.ToString());
    }


    Once the user take the print out then keep that printer in the session or store it in the database table for maintain the default printer.

    Thanks,
    Senthil.
    0