Thursday, March 22, 2012

mod

I have a piece of code that I found to allow me to page through the
records in a datalist. For the most part I understand it but I am a bit
confused by the following.

tmpInt = CInt(intRecordCount.Text) Mod CInt(intPageSize.Text)

This is the in the code when the "last" link is clicked. What does Mod
refer to?

Any help appreciated!

Laura K

(below is the full code for the sub)
Public Sub ShowLast(ByVal s As Object, ByVal e As EventArgs)
Dim tmpInt As Integer

tmpInt = CInt(intRecordCount.Text) Mod CInt(intPageSize.Text)
If tmpInt > 0 Then
intCurrIndex.Text = CStr(CInt(intRecordCount.Text) -
tmpInt)
Else
intCurrIndex.Text = CStr(CInt(intRecordCount.Text) -
CInt(intPageSize.Text))
End If
Datastuff()

End SubLaura K wrote:
> I have a piece of code that I found to allow me to page through the
> records in a datalist. For the most part I understand it but I am a bit
> confused by the following.
>
> tmpInt = CInt(intRecordCount.Text) Mod CInt(intPageSize.Text)
> This is the in the code when the "last" link is clicked. What does Mod
> refer to?

Mod is an operator: divides two integers and returns the remainder (only):
http://msdn.microsoft.com/library/d...ml/vaoprmod.asp

--
Craig
Microsoft MVP - ASP/ASP.NET
So is the value of tmpint the remainder of intRecordCount.text divided
by intPageSize.text?
On Wed, 29 Mar 2006 16:43:59 -0600, Laura K <klkazan@.charter.net> wrote:

> So is the value of tmpint the remainder of intRecordCount.text divided
> by intPageSize.text?

yes!

--
Craig
Microsoft MVP - ASP/ASP.NET

0 comments:

Post a Comment