Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9007097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:35:41+00:00 2026-06-16T01:35:41+00:00

I am dynamically creating dgv and i have to make a event on its

  • 0

I am dynamically creating dgv and i have to make a event on its cell click, how can i do this?
Right now when i create the cellclick event, it fires nothing.

Code to make dgv:

               dataGridView2 = new DataGridView();

                DataGridViewColumn col1 = new DataGridViewImageColumn
                {
                    ImageLayout = DataGridViewImageCellLayout.Stretch
                };

                DataGridViewColumn col2 = new DataGridViewImageColumn
                {
                    ImageLayout = DataGridViewImageCellLayout.Stretch
                };

                DataGridViewColumn col3 = new DataGridViewTextBoxColumn();
                DataGridViewColumn col4 = new DataGridViewLinkColumn();
                DataGridViewColumn col5 = new DataGridViewTextBoxColumn();
                DataGridViewColumn col6 = new DataGridViewTextBoxColumn();
                DataGridViewColumn col7 = new DataGridViewTextBoxColumn();

                col1.HeaderText = "TPM Image";
                col1.Name = "image_tpm";
                col1.Width = 60;

                col2.HeaderText = "Find Image";
                col2.Name = "image_thefind";
                col2.Width = 60;

                col3.HeaderText = "Name";
                col3.Name = "name";
                col3.Width = 150;

                col4.HeaderText = "URL";
                col4.Name = "product_url";
                col4.Width = 100;

                col5.HeaderText = "Price";
                col5.Name = "price";
                col5.Width = 70;

                col6.HeaderText = "Accuracy";
                col6.Name = "image_accuracy";
                col6.Width = 52;

                col7.HeaderText = "History";
                col7.Name = "history";
                col7.Width = 200;

                dataGridView2.Columns.Add(col1);
                dataGridView2.Columns.Add(col2);
                dataGridView2.Columns.Add(col3);
                dataGridView2.Columns.Add(col4);
                dataGridView2.Columns.Add(col5);
                dataGridView2.Columns.Add(col6);
                dataGridView2.Columns.Add(col7);

                dataGridView2.Location = new System.Drawing.Point(650, 20);
                dataGridView2.Size = new System.Drawing.Size(702, 413);
                this.Controls.Add(dataGridView2);

My cellClickEvent

private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
{
    try
    {
        if (dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Contains("http:"))
        {
            Process.Start(dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
        }
    }
    catch
    {
    }
}

But nothing is happening.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:35:42+00:00Added an answer on June 16, 2026 at 1:35 am
    dataGridView2.CellClick += new DataGridViewCellEventHandler(dataGridView2_CellClick);
    

    Got worked.>:)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am dynamically creating divs by incrementing their class names. Now i have a
After dynamically creating an element with this: $('#btnAddBanner').click(function () { var uid = new
I have found code like this for dynamically creating a Grid and some columns:
I´m dynamically creating an instance of a class with reflection and this works fine,
I am dynamically creating a RadGrid and adding GridTemplateColumns to it. Those columns have
I am dynamically creating a table that contains a textbox in each cell. The
I'm currently dynamically creating UIButton objects in my view. I have an NSMutableArray containing
I am dynamically creating a combobox like this: public Control GenerateList(Question question) { //
I'm dynamically creating DataGrid columns (based on an event from my ViewModel) and programmatically
I have 4 UITextFields that I'm dynamically creating, in the viewDidLoad, which works good.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.