简体   繁体   中英

How to press the link in the datagridview1 and go to the another form?

How to press the link in the datagrid and go to the another form?

在此处输入图片说明

Code:

foreach (DataRow item in ds.Tables["timeentryrangedetails"].Rows)
        {
            DataGridViewLinkColumn link = new DataGridViewLinkColumn();             
            dataGridView1.Columns.Add(link);
            int n = dataGridView1.Rows.Add();
            link.Text = "Details";
            link.UseColumnTextForLinkValue = true;
            dataGridView1.Rows[n].Cells[0].Value = link.Text;
            dataGridView1.Rows[n].Cells[1].Value = item["CutoffID"].ToString();
            dataGridView1.Rows[n].Cells[2].Value = item["StartDate"].ToString();
            dataGridView1.Rows[n].Cells[3].Value = item["EndDate"].ToString();
            dataGridView1.Rows[n].Cells[4].Value = item["withTax"].ToString();
            dataGridView1.Rows[n].Cells[5].Value = item["SSS"].ToString();
            dataGridView1.Rows[n].Cells[6].Value = item["PhilHealth"].ToString();
            dataGridView1.Rows[n].Cells[7].Value = item["Pagibig"].ToString();
            dataGridView1.Rows[n].Cells[8].Value = item["status"].ToString();
        }

you can use the DataGridViewLinkColumn.

For more information read it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM