private void button1_Click(object sender, EventArgs e) { NewMessageDialog dialog = new NewMessageDialog(); if (dialog.ShowDialog() == DialogResult.OK) { int messageId = this.AddMessage(dialog.Subject, dialog.User, DateTime.Today, DBNull.Value); //Find messageid in the control to select the new item gridEX1.Find(gridEX1.RootTable.Columns["MessageID"], ConditionOperator.Equal, messageId, -1, 1); } dialog.Dispose(); }
private void button2_Click(object sender, EventArgs e) { GridEXRow currentRow = this.gridEX1.GetRow(); if (currentRow == null || currentRow.RowType != RowType.Record) { MessageBox.Show("Select a row first."); } else { NewMessageDialog dialog = new NewMessageDialog(); dialog.Subject = "Re: " + currentRow.Cells["Subject"].Text; if (dialog.ShowDialog() == DialogResult.OK) { int messageId = this.AddMessage(dialog.Subject, dialog.User, DateTime.Today, currentRow.Cells["MessageID"].Value); //Find messageid in the control to select the new item gridEX1.Find(gridEX1.RootTable.Columns["MessageID"], ConditionOperator.Equal, messageId, -1, 1); } dialog.Dispose(); } }