コード例 #1
0
        // fetch all rows from the SOAP layer and populate the ComboBox with it
        // links:
        //  docLink: http://sql2x.org/documentationLink/4ccfdfd8-9986-4cfe-8743-e0bcde887284
        public void PopulateCombo()
        {
            if (!DesignMode && cboRef.DataSource == null)
            {
                CrudeBookingSourceRefServiceClient bookingSourceRef = null;

                try {
                    bookingSourceRef = new CrudeBookingSourceRefServiceClient();
                    List <CrudeBookingSourceRefContract> contracts = bookingSourceRef.FetchAll();

                    cboRef.DataSource    = contracts;
                    cboRef.DisplayMember = "BookingSourceName";
                    cboRef.ValueMember   = "BookingSourceRcd";
                } catch (Exception ex) {
                    if (ex != null)
                    {
                    }
                } finally {
                    if (bookingSourceRef != null)
                    {
                        bookingSourceRef.Close();
                    }
                }
            }
        }