i want to comare textbox value with datagridview items before adding this textbox value in datagridview
Ahmed_43 0 Newbie Poster
Recommended Answers
Jump to PostHi Ahmed 43, welcome at DaniWeb.
What difficuties do you have with looping through all the DataGridView cells and comparing each value with that of the TextBox?
Jump to PostHi try something using
foreach
loops in your DataGridView and then compare usingforeach (DataGridViewRow r in myDataGridView.Rows) { if (r.Cells["ColumnName"].Value.ToString() == myTextBox.Text) { // Whatever you wish to do with this condition matching. } }
Hope that helps.
All 5 Replies
ddanbe 2,724 Professional Procrastinator Featured Poster
Ahmed_43 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
KushMishra 38 Senior Technical Lead
JOSheaIV 119 C# Addict
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.