I'm not even sure if I'm on the right track, but I am trying to count the excel rows for a worksheet and display them in a textox on my form. I've assuming it would be best to write the row count in the form load procedure and this is what I've got so far, but no luck getting it to work. If it helps, the "Property" tables is one of the four worksheets created on-the-fly, when the program is started.

Private Sub Item_Number_Tracking(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles MyBase.load

Dim No_of_Items as Integer
Dim No_of_Items_Text as Integer

No_of_Items = PFC Xpress.Tables("Property").Rows.Count

If No_of_Items = 0 Then
   No_of_Items_Text = 1 & Me.NoOfItems.Text = 1

Else
   Me.NoOfItems.Text =+1

End If

End Sub

You could do some work around if your using database

Try to upload your excel to a datatable then count the number of rows

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.