Exemple #1
0
        private void NewWPN_Load(object sender, EventArgs e)
        {
            DBCategory dbc = new DBCategory("WPNAMELIST");

            cbCategory.ValueMember   = "ID";
            cbCategory.DisplayMember = "CATEGORYNAME";
            cbCategory.DataSource    = dbc.GetAllExceptAll();

            if (AccessMode == "NEWCLONE")
            {
                if (Clone.IDCat != 0)
                {
                    cbCategory.SelectedValue = Clone.IDCat;
                }
                else
                {
                    cbCategory.SelectedValue = 1;
                }
            }
            if (AccessMode == "NEW")
            {
                cbCategory.SelectedValue = 1;
            }
            if (AccessMode == "EDIT")
            {
                if (EditWP.IDCat != 0)
                {
                    cbCategory.SelectedValue = EditWP.IDCat;
                }
                else
                {
                    cbCategory.SelectedValue = 1;
                }
            }
            if (AccessMode == "VIEWONLY")
            {
                if (ViewWP.IDCat != 0)
                {
                    cbCategory.SelectedValue = ViewWP.IDCat;
                }
                else
                {
                    cbCategory.SelectedIndex = 0;
                }
            }
            LoadSubs((int)cbCategory.SelectedValue);
            if (AccessMode == "NEWCLONE")
            {
                cbSubCategory.SelectedValue = Clone.IDSubCat;
            }
            if (AccessMode == "EDIT")
            {
                cbSubCategory.SelectedValue = EditWP.IDSubCat;
            }
            if (AccessMode == "VIEWONLY")
            {
                cbSubCategory.SelectedValue = ViewWP.IDSubCat;
            }

            button1.Select();
        }