示例#1
0
        private void dataGridView1_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            if (dataGridView1.Columns [e.ColumnIndex].Name.Equals("programId", System.StringComparison.OrdinalIgnoreCase))
            {
                FormProgram from = new FormProgram( );
                from.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                if (from.ShowDialog( ) != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                FishEntity.ProgramEntity model = from.model;
                dataGridView1.Rows [e.RowIndex].Cells ["programId"].Value   = model.programId;
                dataGridView1.Rows [e.RowIndex].Cells ["programName"].Value = model.programName;
            }

            if (dataGridView1.Columns [e.ColumnIndex].Name.Equals("userName", System.StringComparison.OrdinalIgnoreCase))
            {
                FormUserList from = new FormUserList(true);
                from.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                if (from.ShowDialog( ) != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                FishEntity.PersonEntity model = from.SelectedPersion;
                dataGridView1.Rows [e.RowIndex].Cells ["userName"].Value = model.username;
                dataGridView1.Rows [e.RowIndex].Cells ["userNum"].Value  = model.realname;
            }
        }
示例#2
0
        private void txtCgR_Click(object sender, EventArgs e)
        {
            FormUserList from = new FormUserList(true);

            from.StartPosition = FormStartPosition.CenterParent;
            if (from.ShowDialog( ) != DialogResult.OK)
            {
                return;
            }
            txtCgR.Text = from.getStr;
        }
        protected void SelectMan(TextBox txt)
        {
            FormUserList form = new FormUserList(true);

            form.StartPosition = FormStartPosition.CenterParent;
            form.ShowInTaskbar = false;
            DialogResult result = form.ShowDialog( );

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                FishEntity.PersonEntity person = form.SelectedPersion;
                if (person != null)
                {
                    txt.Text = person.realname;
                    txt.Tag  = person.id;
                }
            }
        }