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

  • SEARCH
  • Home
  • 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 6470719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:08:35+00:00 2026-05-25T06:08:35+00:00

I have a datagrid view with three columns and one button column. My aim

  • 0

I have a datagrid view with three columns and one button column. My aim is that I want to send an automatic email to the specified mail id when I click on the button in button column of the datagrid view.

Is it possible to do so that if I click on the button column, a mail will be sent to this mail id: abc@shx.com?

The corresponding row values will be attached to body of the mail. Is it possible to do these three steps:

  1. Handling the click event (button column click event)..
  2. Finding the corresponding row values and attached to mail body
  3. Sending the email to given mail id (if I click on the button column (only on the button))

Would anyone suggest me any ideas for doing these all? I am doing WinForms application using C#.

EDIT :

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) 
{ 
    if (e.ColumnIndex != 3) 
        return; 
    object col1 = dataGridView1.Rows[e.RowIndex].Cells[0].Value; 
    object col2 = dataGridView1.Rows[e.RowIndex].Cells[1].Value; 
    object col3 = dataGridView1.Rows[e.RowIndex].Cells[2].Value; 
} 

But I don’t know how to get the row values and send an email.

  • 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-05-25T06:08:35+00:00Added an answer on May 25, 2026 at 6:08 am

    In your example you already got the row values corresponding to the row being clicked:

    object col1 = dataGridView1.Rows[e.RowIndex].Cells[0].Value; 
    object col2 = dataGridView1.Rows[e.RowIndex].Cells[1].Value; 
    object col3 = dataGridView1.Rows[e.RowIndex].Cells[2].Value;
    

    as far as sending an email in .NET is concerned, you could use the SmtpClient class. Here’s an example with Gmail:

    var client = new SmtpClient("smtp.gmail.com", 587);
    client.EnableSsl = true;
    client.Credentials = new NetworkCredential("youraccount@gmail.com", "secret");
    
    var mail = new MailMessage();
    mail.From = new MailAddress("youraccount@yahoo.com");
    mail.To.Add("destaccount@gmail.com");
    mail.Subject = "This is the subject of the mail";
    mail.Body = "This is the body of the mail";
    client.Send(mail);
    

    Of course you should adapt your Smtp server configuration to match your settings.

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

Sidebar

Related Questions

I have a DataGridView that has three read only columns in it and one
I have three column in my datagridview .One is text ,one is Combo and
I have a DataGridView in which one column has data that the user needs
I have a DataSet that contains a few columns. One of these columns is
i have one datagridview.in my datagridview is having four row and three columns.after enter
I have a datagrid that displays items with two columns of text row data
I have a datagridview with one DataGridViewCheckBoxColumn and some other TextBox Columns. I want
In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One
I have a Data Grid View inside a control that is displayed in a
I have a DataGridView that I want to query using Linq (C# WinForm). I

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.