コード例 #1
0
        private void rbText_CheckedChanged(object sender, EventArgs e)
        {
            tbText.Text           = tbFajl.Text = tbBaza.Text = label1.Text = string.Empty;
            gridIzBaze.DataSource = null;

            string name = ((RadioButton)sender).Name;

            switch (name)
            {
            case "rbText":
                tbText.Enabled  = true;
                btnFajl.Enabled = tbFajl.Enabled = tbBaza.Enabled = false;
                break;

            case "rbFajl":
                tbText.Enabled  = tbBaza.Enabled = false;
                btnFajl.Enabled = tbFajl.Enabled = true;
                tbFajl.ReadOnly = true;
                break;

            case "rbBaza":
                tbText.Enabled  = btnFajl.Enabled = tbFajl.Enabled = false;
                tbBaza.Enabled  = true;
                tbBaza.ReadOnly = true;
                BL.BL obj = new BL.BL();
                gridIzBaze.DataSource = obj.GetAllCategories().Tables[0];
                break;
            }
        }
コード例 #2
0
        private void btnFajl_Click(object sender, EventArgs e)
        {
            traziFajl.Filter   = "Text files|*.txt";
            traziFajl.FileName = "";

            DialogResult result = traziFajl.ShowDialog();

            if (result == DialogResult.OK)
            {
                BL.BL obj = new BL.BL();
                tbFajl.Text = obj.GetTextFromFile(traziFajl.FileName);
            }
        }