printersetupdialog starting printer
delphi, delphi-xe2
Solution
You can set the initial selected printer of the printer setup dialog using the `Printer` function.
uses
Printers;
...
...
begin
Printer.PrinterIndex:=Printer.Printers.IndexOf(txtPrinterName.Text);
PrinterSetupDialog1.Execute;
end;
Problem
I'm making an application in Embarcadero Delphi XE2. I'm using a PrinterSetupDialog to select a printer name into TEdit like: ``` if PrinterSetupDialog1.Execute() then begin txtPrinterName.Text := Printer.Printers[Printer.PrinterIndex]; ConfigINI.modified := true; end; ``` The problem I have is that this PrinterSetupDialog when executed, always selects the same printer at start. I can switch to another ok and the TEdit gets filled ok. What I want to do is: Before executing the PrinterSetupdialog have it set dialog's selected printer to the one in the TEdit for example: ``` PrinterSetupDialog.PrinterSelectedAtExecute := txtPrinterName.Text; ``` Help appreciated. Thanks.