//will be when click the table's tuple private void dgv_Document_CellClick(object sender, DataGridViewCellEventArgs e) { //selected cell int chosen = dgv_Document.SelectedCells[0].RowIndex; //assign the data in the zeroth index to the fileID variable String fileID = dgv_Document.Rows[chosen].Cells[0].Value.ToString(); //assign the data in the first index to the name variable String name = dgv_Document.Rows[chosen].Cells[1].Value.ToString(); //assign the data in the second index to the path variable String path = dgv_Document.Rows[chosen].Cells[2].Value.ToString(); //assign the data in the fourth index to the userID variable String userID = dgv_Document.Rows[chosen].Cells[4].Value.ToString(); //transferring value from path to label labelFilePath.Text = path; //transferring value from name to combobox comboboxFileName.Text = name; //change font color comboboxFileName.ForeColor = Color.Black; //transferring value from userID to textbox textBoxUserID.Text = userID; //transferring value from fileID to textbox textBoxFileID.Text = fileID; //contact PDFForm PDFForm form = new PDFForm(); //assigning the value in the label to a variable named filepathh in the PDFForm form.filePathh = labelFilePath.Text; //open the PDFForm form.ShowDialog(); }
//when the click this button; private void btn_browse_Click(object sender, EventArgs e) { //for open pdf files OpenFileDialog openPdf = new OpenFileDialog(); openPdf.Title = "Open PDF"; openPdf.Filter = "PDF Files (*.Pdf) | *.Pdf"; if (openPdf.ShowDialog() == DialogResult.OK) { textboxFilePath.Text = openPdf.FileName; //contact PDFForm PDFForm newform = new PDFForm(); //assigning the value in the textbox to a variable named filepathh in the PDFForm newform.filePathh = textboxFilePath.Text; //open the PDFForm newform.ShowDialog(); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { //selected cell int chosen = dataGridView1.SelectedCells[0].RowIndex; //assign the data in the zeroth index to the id variable String id = dataGridView1.Rows[chosen].Cells[0].Value.ToString(); //assign the data in the first index to the name variable String name = dataGridView1.Rows[chosen].Cells[1].Value.ToString(); //assign the data in the second index to the path variable String path = dataGridView1.Rows[chosen].Cells[2].Value.ToString(); //assign the data in the third index to the date variable String date = dataGridView1.Rows[chosen].Cells[3].Value.ToString(); //assign the data in the fourth index to the uid variable String uid = dataGridView1.Rows[chosen].Cells[4].Value.ToString(); //transferring value from id to textbox textboxFileID.Text = id; textboxFileID.ForeColor = Color.Black; //transferring value from name to textbox textboxFileName.Text = name; textboxFileName.ForeColor = Color.Black; //transferring value from path to textbox textboxFilePath.Text = path; textboxFilePath.ForeColor = Color.Black; //transferring value from uid to combobox comboboxUserID.Text = uid; comboboxUserID.ForeColor = Color.Black; //transferring value from date to textbox textboxFileDate.Text = date; textboxFileDate.ForeColor = Color.Black; //contact PDFForm PDFForm newForm = new PDFForm(); //assigning the value in the textbox to a variable named filepathh in the PDFForm newForm.filePathh = textboxFilePath.Text; //open the PDFForm newForm.ShowDialog(); }