private void previewDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1 && previewOn) { DataGridViewSelectedRowCollection rowPrev = MainDGV.SelectedRows; if (rowPrev.Count != 1) { MessageBox.Show("Please select only one row.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string matchline = rowPrev[0].Cells[4].Value.ToString(); string path = rowPrev[0].Cells[5].Value.ToString(); string component = rowPrev[0].Cells[1].Value.ToString(); string type = rowPrev[0].Cells[2].Value.ToString(); PreviewForm preview = new PreviewForm(); preview.Text = component + "." + type; string prev = rowPrev.ToString(); preview.previewTextBoxLoad(sender, e, matchline, component, path); preview.ShowDialog(); } } else if (!previewOn) { MessageBox.Show("Please perform a new search to re-enable the preview.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch { MessageBox.Show("There was an error in the execution, please restart the app and try again.\nIf the issue persist please reach the dev.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } }
private void textBox1_DragDrop(object sender, DragEventArgs e) { DataGridViewSelectedRowCollection item = (DataGridViewSelectedRowCollection)e.Data.GetData(e.Data.GetFormats()[0]); textBox1.Text = item.ToString(); }