How can I count the number of items in the listview.
Example scenario.
Today, I added students say, 20 students.
and tomorrow I added another 15 students, i need to have a breakdown on how many students i have been adding per day. Please help me. Thank you guys!

I'm assuming you are keeping the data in some sort of database (text, XML, Excel, Access, SQL, etc). In that case you wil have to create a table to keep track of the additions. Keep more info rather than less. For example, you asked how to keep track of the number of students. I suggest you keep track of which students as well. That way you can query not just how many students were added on a particular day (or days), but which students as well. The table might look like

RecordNum (primary key - autonumber)
DateAdded
StudentID

The exact structure would depend on your current implementation.

Ok I get it, I'll do that. Thank You :)

I have a random question I would just like to clarify.
I have the table for student information right, and another for the images. when i delete a student, the pic of the student is not deleting also. i was wondering if i put a relationship between the two table will that happen? when i delete a student, the picture of that student will also be deleted?

I'm assuming you are keeping the data in some sort of database (text, XML, Excel, Access, SQL, etc). In that case you wil have to create a table to keep track of the additions. Keep more info rather than less. For example, you asked how to keep track of the number of students. I suggest you keep track of which students as well. That way you can query not just how many students were added on a particular day (or days), but which students as well. The table might look like

RecordNum (primary key - autonumber)
DateAdded
StudentID

The exact structure would depend on your current implementation.

The database im using is mssql. i have a question, can't i just add the recordnum field together with my student info table? i already have a dateadded field in my table. can i just put the recordnum in the same table with the student information?

I only have experience with MS SQL. I seem to recall that you can use a setting called referential integrity. This is supposed to ensure that when you delete a record in a table, all other recoeds in tables that depend on that record are automatically deleted. Wrox Press Professional SQL Server states

SQL Server 2000 was the first version to support two of the most commonly requested forms of referential integrity actions: cascade updates and cascade deletes. These were common complaint areas, but Microsoft left some other areas of ANSI referential integrity support out. These were added in SQL Server 2005. You look at cascading and other ANSI referential integrity actions in detail when you look at FOREIGN KEY constraints.

You might also check http://www.cs.sfu.ca/CourseCentral/354/zaiane/material/notes/Chapter6/node7.html

If you already have a dateadded field then just go with that. It will work like you want. You don't need a separate table. To get some numbers you could do a query like (I am using a local table here)

select COUNT(*) from employee where hire_date between '1989-01-01' and '1989-12-31'

Dim cmd As New SqlCommand
        Dim da As New SqlDataAdapter
        Dim ds As New DataSet
        Dim dt As New DataTable
        Dim con As New SqlConnection("Data Source=CAMILLEPC;Initial Catalog=WAIS;Integrated Security=True")

        con.Open()

        Try
            cmd = con.CreateCommand
            cmd.CommandText = "SELECT * FROM record_count"
            da.SelectCommand = cmd
            da.Fill(ds, "record_count")
            dt = ds.Tables("record_count")
            MsgBox("Number of records: " & dt.Rows.Count)




        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
        End Try

I found this code on the net, and there's no error but the output is wrong because it says i only have one record, but on my database i have 3. i tried it on different tables it still says 1. And how can i filter it by date enrolled, and how can i show it on the textbox?

Can you dump the records from record_count as text and post them? I'll try it locally. Also, please post the SQL commands to create the table. If you are running SQL_Express I strongly suggest (if you don't already have it) downloading the free Microsoft SQL Server Management Studio.

I tried it on one of my tables and got the correct record count.

I already solved this, i asked my friend for help :)
Thank you for the replies, much appreciated!

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.