private void ForeignButtClick(object sender, EventArgs e) { int ind = (int)((Button)sender).Tag; string neededTable = sil[ind].hc.toTableName; var dialog = new CheckForeignForm(neededTable, "select * from [" + neededTable + "]", sil[ind].code); dialog.ShowDialog(); var el = sil[ind]; el.code = dialog.key; el.control.Text = el.code; sil[ind] = el; }
private void gridOutput_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { string colName = dbi.Headers[e.ColumnIndex].toColumnName; string keyValue = dbi.Table.Rows[e.RowIndex].ItemArray[e.ColumnIndex].ToString(); string tableName = dbi.Headers[e.ColumnIndex].toTableName; string command = "select * from [" + tableName + "] where [" + colName + "] = \'" + keyValue + "\'"; var foreignForm = new CheckForeignForm(tableName, command); foreignForm.ShowDialog(); } }