Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
5
Answers
Add entry into datagridview cell based on another cell value
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
mike Delvotti
11y
26.1k
1
Reply
I'm trying to auto enter todays date in a datagriview cell when a user clicks a value in another cell to "YES"
I'm nearly there but my code below has something stopping it working?
I think it's on this line:
if (content.ToLower().Trim() == "YES")
Below is my example:
if (e.ColumnIndex != 4 || e.ColumnIndex != 4) return;
object obj = suppliersDataGridView.Rows[e.RowIndex].Cells[4].Value;
if (obj != null && !DBNull.Value.Equals(obj))
{
string content = obj.ToString();
if (content.ToLower().Trim() == "YES")
{
suppliersDataGridView.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("dd-MM-yyyy");
}
}
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
How doing I do a payment page that take master card & paypal
export the data 1by1 like ID card format to xls from sql(C#)