Exemplo n.º 1
0
        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            short Kind = 1;

            MyDBTableAdapters.ARCHIVETableAdapter Ta = new ARCHIVETableAdapter();
            if (radioButton2.Checked)
            {
                Kind = 2;
                comboBox2.SelectedIndex = 3;
                comboBox2.Enabled       = false;
                comboBox3.Enabled       = true;
                comboBox4.Enabled       = true;
            }
            if (radioButton1.Checked)
            {
                Kind = 1;
                comboBox2.SelectedIndex = 0;
                comboBox2.Enabled       = true;
                comboBox3.Enabled       = false;
            }
            if (radioButton3.Checked)
            {
                Kind = 3;
                comboBox2.SelectedIndex = 0;
                comboBox2.Enabled       = true;
                comboBox3.Enabled       = true;
            }
            if (radioButton4.Checked)
            {
                Kind = 4;
                comboBox2.SelectedIndex = 0;
                comboBox2.Enabled       = true;
                comboBox3.Enabled       = true;
            }
            MyDB.ARCHIVEDataTable Dt = Ta.SelectProgs(Kind);
            comboBox1.Items.Clear();

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                MyList.MyListItem LstTitle = new MyList.MyListItem(Dt[i]["TITLE"].ToString(), int.Parse(Dt[i]["ID"].ToString()));
                comboBox1.Items.Add(LstTitle);
            }
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[1];
            }
            catch
            {
                MessageBox.Show("زبان فارسی به عنوان زبان دوم در سیستم وحود ندارد");
            }

            for (int i = 1; i < 32; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(string.Format("{0:00}", i), i);
                CmbDay.Items.Add(Lst);
                comboBox4.Items.Add(Lst);
            }
            CmbDay.SelectedIndex    = 0;
            comboBox4.SelectedIndex = 0;


            for (int i = 1; i < 13; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(string.Format("{0:00}", i), i);
                CmbMonth.Items.Add(Lst);
                comboBox5.Items.Add(Lst);
            }
            CmbMonth.SelectedIndex  = 0;
            comboBox5.SelectedIndex = 0;


            for (int i = 1380; i < 1400; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(i.ToString(), i);
                CmbYear.Items.Add(Lst);
                comboBox6.Items.Add(Lst);
            }
            CmbYear.SelectedIndex   = 0;
            comboBox6.SelectedIndex = 0;


            MyDBTableAdapters.ARCHIVETableAdapter Ta = new ARCHIVETableAdapter();
            MyDB.ARCHIVEDataTable Dt = Ta.SelectProgs(1);
            comboBox1.Items.Clear();

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                MyList.MyListItem LstTitle = new MyList.MyListItem(Dt[i]["TITLE"].ToString(), int.Parse(Dt[i]["ID"].ToString()));
                comboBox1.Items.Add(LstTitle);
            }


            comboBox3.Items.Clear();
            for (int i = 1; i < 366; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(i.ToString(), i);
                comboBox3.Items.Add(Lst);
            }
            comboBox3.SelectedIndex = 0;


            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
        }