Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello how can i count a word in dataGridView like an example

i have a cars model 

BMW, Audi, Mitsubishi, Mercedes .etc

i want a code to count how many bmw i have ,how many Mercedes i have. etc

in a lable.text


What I have tried:

<pre>            int x = 4;
            label10.Text = (from Rows in dataGridView1.Rows.Cast<DataGridViewRow>() 
                            where !Rows.IsNewRow && Rows.Cells(x).ToString == "Audi"
                            select Rows).Count;
Posted
Comments
OriginalGriff 6-Aug-22 7:02am    
And?
What does it do that you didn't expect, or not do that you did?
What have you tried to do to find out why?
Are there any error messages, and if so, where and when? What did you do to make them happen?

This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Use the "Improve question" widget to edit your question and provide better information.
[no name] 6-Aug-22 12:21pm    
You query the data, not the "grid". If you don't know where the data came from, find out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900