HI I HAVE MS ACCESS TABLE COLUMNS SEX (MALE FEMALE) CLASS (6,7,8,9,10,11,12) I WANT TO COUNT HOW MANY MALES IN CLASS 6 AND HOW MANY GRILS IN 6.AND I WANT COUNT EACH CLASS. I AM TRYED BY THIS CODE BUT ITS NOT WORKING

      Dim Y As Integer = 9
      Dim x As Integer = 10


Label13.Text = (From Rows In STUDENT_REPORTDataGridView.Rows.Cast(Of DataGridViewRow)() Where Not Rows.IsNewRow AndAlso Rows.Cells(x).Value.ToString = "6" & Rows.IsNewRow AndAlso Rows.Cells(Y).Value.ToString = "MALE").Count

COULD YOU STOP SHOUTING LIKE THAT!!!
And tell us WHAT is not working.

Hi Sir John 91;

Caps off please;

Correct me if I'm wrong, your front end is MS Access and your back end is VB.net?

Dim Y As Integer = 9
Dim x As Integer = 10

X and Y should be a variable, but if you indicate with number it is like

X = 9;
y = 10;

The logic of the system will start counting to 9,10,11,12,... not in 0/1,..

X and Y is variable 9 and 10 is 9th columns and 10th columns ymy back end is vb.bet 2010

hi sir ddanbe my queastion is i am doing project. where my ms access data base have 14 columns. Now i want count if columns 9 value and columns 10 value meet critaria. for that i used below code can u tell where i making mistake i am using vb.net 2010

      Dim Y As Integer = 9
      Dim x As Integer = 10
Label13.Text = (From Rows In STUDENT_REPORTDataGridView.Rows.Cast(Of DataGridViewRow)() Where Not Rows.IsNewRow AndAlso Rows.Cells(x).Value.ToString = "6" & Rows.IsNewRow AndAlso Rows.Cells(Y).Value.ToString = "MALE").Count
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.