How to add actual record number and total record number


Author
Message
Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi

I have a maintenance form, I want to show the number of the actual record and the total number of records, I have this:

Private Sub BO_Publicaciones_Navigated(ByVal e As MicroFour.StrataFrame.Business.NavigatedEventArgs) Handles BO_Publicaciones.Navigated

'-- Establish Locals

Dim lcMsg As String

lcMsg = Me.BO_Publicaciones.CurrentRowIndex.ToString() & " 0f " & Me.BO_Publicaciones.Count.ToString()

Me.LabelControlNumberOfrecords.Text = lcMsg

End Sub

This works for the total number, but the first record is 0 and if I have 17 records navigating goes 0, 1,2...16 I know that the count is correct but I need to star in 1 not in 0.

Thanks for your help

Regards



Smile Everything is possible, just keep trying...
Peter Jones
Peter Jones
Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Jaun,

Most indexes are 0 based so, to fix the display, you could try (haven't tested this so syntax may not be 100% correct):

lcMsg = String.Format("{0} of {1}", Me.BO_Publicaciones.CurrentRowIndex + 1, Me.BO_Publicaciones.Count + 1)

String.Format tends to be a better way to concatinate data like this.

Cheers, Peter

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Peter Jones (03/22/2008)
Hi Jaun,

Most indexes are 0 based so, to fix the display, you could try (haven't tested this so syntax may not be 100% correct):

lcMsg = String.Format("{0} of {1}", Me.BO_Publicaciones.CurrentRowIndex + 1, Me.BO_Publicaciones.Count + 1)

String.Format tends to be a better way to concatinate data like this.

Cheers, Peter

Hi Peter, Juan,

Actually you don't need to add "+ 1" to the BO.Count property since it will have the corrected total count number.  So the code should be:

lcMsg = String.Format("{0} of {1}", Me.BO_Publicaciones.CurrentRowIndex + 1, Me.BO_Publicaciones.Count)



Edhy Rijo

Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi Edji, Peter

I try both, Edji yours was the correct one, if I have 17 records and use Peter's code the it tells me that are 18 records.

Thanks both for your help and take the time to point me in the rigth direction.

Regards

Thanks

Hi Peter, Juan,

Actually you don't need to add "+ 1" to the BO.Count property since it will have the corrected total count number.  So the code should be:

lcMsg = String.Format("{0} of {1}", Me.BO_Publicaciones.CurrentRowIndex + 1, Me.BO_Publicaciones.Count)



Smile Everything is possible, just keep trying...
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hola Juan Carlos,

Glad to be of any help, even though I had to try the code before posting because I am also new to SF Tongue.

Even though I live in USA for many years I am from Dominican Republic and do speak Spanish in case you or anyone else need some help in Spanish, well your English is pretty good, so I don't think you'll need it Cool

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Just FYI...any collection count will always return the actual count.  This is not just specific to the SF BOs, but any collection or array in .NET.  The only time that you have to take the zero based logic into account is when dealing with an index...this will always be zero based. 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search