Click here to Skip to main content
16,018,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Please see the image below.

ask link — IMAGE[^]

And this is the way I make a button in datagridview.
private void FrmHelp_Load(object sender, EventArgs e)
        {
            var ActionButton = new DataGridViewButtonColumn();
            ActionButton.Name = "dataGridViewActionButton";
            ActionButton.HeaderText = "Action";
            ActionButton.Text = "View";
            ActionButton.UseColumnTextForButtonValue = true;
            this.dataGridView1.Columns.Add(ActionButton);
        }


The link shown in datagridview is from my database.
ask link db — IMAGE[^]

What I have tried:

And my problem is that when I click the button, I don't know how to call it through a MySQL query.
private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
       {
           if (e.ColumnIndex == 5)
           {
               //help
           }
       }
Posted
Updated 15-Aug-24 17:35pm
v2

1 solution

Quote:
when I click the button, I don't know how to call it through a MySQL query.
Why would you need to? If you have the relevant URL in your DGV row already (and it looks like you do) just use the RowIndex and the appropriate column (4, probably from your code though it's a very bad idea to use numeric indexes here) to get the value from the DGV directly and then use Process.Start to open the browser by passing it the text URL as the command.

What part of this is giving you difficulties?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900