Ejemplo n.º 1
0
        private void inputDataGridView_ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewColumn col = this.inputDataGridView.Columns[e.ColumnIndex];
            StringInputDialog  inp = new StringInputDialog();

            inp.SelectedString = col.Name;
            if (inp.ShowDialog() == DialogResult.OK)
            {
                col.Name = inp.SelectedString;
            }
        }
Ejemplo n.º 2
0
        private void addColumnButton_Click(object sender, EventArgs e)
        {
            StringInputDialog inp = new StringInputDialog();

            if (inp.ShowDialog() == DialogResult.OK)
            {
                DataGridViewColumn col = new DataGridViewColumn(new DataGridViewTextBoxCell());
                col.Name = inp.SelectedString;
                this.inputDataGridView.Columns.Add(col);
            }
        }
Ejemplo n.º 3
0
        public string PromptForUserInput(string inputString)
        {
            if (this.InvokeRequired)
            {
                return(this.Invoke(new PromptDelegate(this.PromptForUserInput), inputString) as string);
            }
            else
            {
                StringInputDialog dialog = new StringInputDialog();

                dialog.SelectedString = "";
                dialog.PromptString   = inputString;

                if (dialog.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
                {
                    throw new Exception("Operation Aborted by User");
                }

                return(dialog.SelectedString);
            }
        }