2
Answers

How to change value of a column in DataGridView?

Mayank Jani

Mayank Jani

7y
217
1
Hiii,
In a C# WinApp, I have a form with a DataGridView and a ComboBox. the DataGridView contains columns i.e. No; Perticular, Quantity, Rate, Amount and Days. the ComboBox contains number 1 to 365.
Now, I am trying to change the 6th column (Days) using the ComboBox numbers. I want to do it as if I select '10' from the ComboBox all the cells in the Days column get that value. In short, I want to change the entire column value with the value selected from the ComboBox regardless, how many rows are there in the gridview.
 
Anybody please help.
 
Thank You.
 
Mayank Jani.
Answers (2)
0
Kirtan Patel

Kirtan Patel

NA 35k 2.8m 15y
Why don't you use Gmail Server . its working well ..

Yahoo Server Does not Provide..SMTP Service for Free

follow this great article ..you will have idea about sending mail with attachment .

http://www.c-sharpcorner.com/UploadFile/meetuchoudhary/sendmail08142009123125PM/sendmail.aspx

code is for asp.net but its working under Windows Form application too...

if my answer helped you then check "Do you like this answer" check box


Accepted
0
hanafi tanudjaja

hanafi tanudjaja

NA 41 0 15y
hello home base


thank you

it work

regard
han
0
Lalit M

Lalit M

NA 6.7k 48k 15y
You can also try this code sample


MailMessage Mail = new MailMessage();

MailAddress ma = new MailAddress(txtFrom.Text,txtName.Text);
Mail.From = ma;
Mail.To.Add(txtTo.Text);

if(txtCC.Text.Trim().Length != 0)
Mail.CC.Add(txtCC.Text);

if(txtBCC.Text.Trim().Length != 0)
Mail.Bcc.Add(txtBCC.Text);

Mail.Subject = txtSubject.Text;


if (txtAttachment.Text.Trim().Length != 0)
{
string sAttach = txtAttachment.Text.Replace("\\","\\\\");
Mail.Attachments.Add(new Attachment(sAttach));
}


//Note: When you make "
IsBodyHtml" to true make
//ValidateRequest="
false" in page derective
//As to make HTML content passed.
Mail.IsBodyHtml = true;
Mail.Body = txtComment.Text;


//Setting Reply address.
if (txtReplyTo.Text.Trim().Length != 0)
{
Mail.Headers.Add("
Reply-To", txtReplyTo.Text);
}
else
{
Mail.Headers.Add("
Reply-To", txtFrom.Text);
}


try
{
SmtpClient smtpMailObj = new SmtpClient();
//eg:localhost, 192.168.0.x, replace with your server name
smtpMailObj.Host = "
myMailServer";
smtpMailObj.Send(Mail);
Response.Write("
Your Message has been sent successfully");
}
catch (Exception ex)
{
Response.Write("
Message Delivery Fails");
}

reference link

more info

hope you will get your answer,Thanks ....