コード例 #1
0
        private void cmbMTNType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                cmbItem.DataSource = null;

                if (cmbStoreFrom.Items.Count > 0)
                {
                    Store objStore = (Store)cmbStoreFrom.SelectedItem;

                    if (cmbMTNType.SelectedItem.Equals("Material"))
                    {
                        cmbItem.DisplayMember = "Item";
                        cmbItem.ValueMember   = "ItemCode";
                        cmbItem.DataSource    = objMaterialDL.GetDataView_Store(objStore.StoreID);
                    }
                    else if (cmbMTNType.SelectedItem.Equals("Basic Product"))
                    {
                        cmbItem.DisplayMember = "Item";
                        cmbItem.ValueMember   = "ItemCode";
                        cmbItem.DataSource    = objBasicProductDL.GetDataView_Store(objStore.StoreID);
                    }
                    else if (cmbMTNType.SelectedItem.Equals("Finish Product"))
                    {
                        cmbItem.DisplayMember = "Item";
                        cmbItem.ValueMember   = "ItemCode";
                        cmbItem.DataSource    = objFinishProductDL.GetDataView_Store(objStore.StoreID);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }