Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

C # how to implement DataGridView pagination

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to achieve DataGridView paging in c #, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

Due to the needs of the project, I wrote a small paging control, as shown below:

Control properties are shown below: four custom properties

Code:

Int pageSize = 10

[Browsable (true)]

[Description ("number of entries per page")]

Public int PageSize

{

Get {return pageSize;}

Set

{

If (pageSize! = value)

{

PageSize = value

This.Invalidate ()

}

}

}

Int pageCount = 10

[Browsable (true)]

[Description ("Total number")]

Public int PageCount

{

Get {return pageCount;}

Set

{

If (pageCount! = value)

{

PageCount = value

This.Invalidate ()

}

}

}

Int pageNumber = 1

[Browsable (true)]

[Description ("Total pages")]

Public int PageNumber

{

Get {return pageNumber;}

Set

{

If (pageNumber! = value)

{

PageNumber = value

This.Invalidate ()

}

}

}

Int pageIndex = 1

[Browsable (true)]

[Description ("current page")]

Public int PageIndex

{

Get {return pageIndex;}

Set

{

If (pageIndex! = value)

{

PageIndex = value

This.Invalidate ()

}

}

}

The control event above the paging control:

There are a lot of paging SQL statements on the Internet, find a matching control, and you can try it. The following picture is a picture of the interface at run time.

Thank you for reading this article carefully. I hope the article "how to achieve DataGridView pagination" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report