private void SelectPrinterForm_Load(object sender, EventArgs e)
        {
            if (Printers.Count == 0)
            {
                AcceptButton  = butCancel;
                butOK.Enabled = false;
            }
            else
            {
                foreach (string s in Printers)
                {
                    cmbPrinters.Items.Add(s);
                }
                cmbPrinters.SelectedIndex = 0;
            }
            RemClientControlObjectProxy theObj;

            theObj = new RemClientControlObjectProxy();
            theObj.ConParameter = conParm;
            thePaperTypes       = new StringCollection();
            try
            {
                thePaperTypes = theObj.GetPaperTypes();
            }
            catch (RemClientControlObjectProxyException)
            {
                MessageBox.Show(GetString("UNABLETOAVAILABLEPAPERTYPESFROMPRINTERSERVICE"));
            }
            finally
            {
                theObj.Dispose();
            }
            foreach (string s in thePaperTypes)
            {
                cmbPapertype.Items.Add(s);
            }
            if (thePaperTypes.Count > 0)
            {
                cmbPapertype.SelectedIndex = 0;
            }
            SetFormTeksten();
        }
        private void PrinterTrayForm_Load(object sender, EventArgs e)
        {
            RemClientControlObjectProxy theObj;

            theObj = new RemClientControlObjectProxy();
            theObj.ConParameter = conParm;

            if (PrinterTray != null)
            {
                cmbTray.Items.Add(pti.TrayName);
                cmbTray.SelectedIndex = 0;
                cmbTray.Enabled       = false;
            }
            else
            {
                StringCollection Trays;

                try
                {
                    Trays = theObj.GetSupportedTraysOfPrinter(pi.LongName);
                }
                catch (RemClientControlObjectProxyException)
                {
                    Trays = new StringCollection();
                }
                foreach (string tn in Trays)
                {
                    //
                    //One should not be able to add a tray 2 times...
                    //
                    bool bSkip = false;
                    foreach (PrinterTrayItem t in Printer.Trays)
                    {
                        if (t.TrayName.Equals(tn, StringComparison.OrdinalIgnoreCase))
                        {
                            bSkip = true;
                            break;
                        }
                    }
                    if (bSkip == false)
                    {
                        cmbTray.Items.Add(tn);
                    }
                }
                if (cmbTray.Items.Count > 0)
                {
                    cmbTray.SelectedIndex = 0;
                }
            }

            StringCollection thePapers;

            thePapers = new StringCollection();
            try
            {
                thePapers = theObj.GetPaperTypes();
            }
            catch (RemClientControlObjectProxyException)
            {
                return;
            }
            finally
            {
                theObj.Dispose();
            }
            int waar = -1;

            foreach (string s in thePapers)
            {
                int h;
                h = cmbPapertype.Items.Add(s);
                if (PrinterTray != null)
                {
                    if (PrinterTray.CurrentPapertypeName == s)
                    {
                        waar = h;
                    }
                }
            }
            if (waar > -1)
            {
                cmbPapertype.SelectedIndex = waar;
            }
            else
            {
                if (cmbPapertype.Items.Count > 0)
                {
                    cmbPapertype.SelectedIndex = 0;
                }
            }
            SetFormTeksten();
        }