重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

vb.net只打印一页 vba 单面打印

在ASP.NET(VB语言)中,想把控件GridView只显示1页,且只有10行。能设置吗,如能,如何设置。

什么意思啊。这个莫名其妙的问题。

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:主机域名虚拟主机、营销软件、网站建设、三门峡网站维护、网站推广。

你的意思是如果GridView有50条数据,然后就显示一页,然后这一页就有10行?

那剩下的40行不要了?

那这样子,数据库查询的时候你只查前面那10条记录不就行了

select top 10 * from table1

如果要是你想弄分页,GridView本来就有分页功能,启用分页,把GridView的PageSize属性改成10就行了

vb.net打印问题

PRINTER.PRINT 用这个,直接打印到默认打印机了,位置的确定是你根据控件的位置就可以确定了

关于VB.NET编制打印程序,打印出来页面内容总是重叠在一起的问题

参考:

把执行SQL语句后得到的记录集逐条(含字段名)显示在LISTVIEW控件中

'----------------------------------------------------------------

Public Sub ListUpdate(ByRef rs As Recordset, ByRef lv As ListView)

Dim head As ColumnHeader, Item As ListItem

Dim i As Integer, j As Integer

Dim lvWidth As Integer

lvWidth = lv.Width

'初始化LISTVIEW的某些属性

lv.View = lvwReport

lv.GridLines = True

lv.FullRowSelect = True

lv.ListItems.Clear

lv.ColumnHeaders.Clear

For i = 0 To rs.Fields.Count - 1

Set head = lv.ColumnHeaders.Add

head.Text = rs.Fields(i).Name

head.Width = lvWidth / rs.Fields.Count

Next

For j = 1 To PERPAGE

If rs.EOF Then Exit For

Set Item = lv.ListItems.Add

Item.Text = "" rs.Fields(0).Value

For i = 1 To rs.Fields.Count - 1

Item.SubItems(i) = "" rs.Fields(i).Value

Next

rs.MoveNext

Next

End Sub

' 打印

Public Sub PrintRecordset(ByRef recRecordset As Recordset, ByVal strType As String)

Dim LeftMargin As Integer

Dim HeadTopPosition As Integer

Dim FieldNum As Integer

Dim PageCounter As Integer

Dim MyRecordset As ADODB.Recordset

Const FooterTopPosition = 24

Set MyRecordset = recRecordset

PageCounter = 1

' 设 置Printer 对 象 坐 标 的 度 量 单 位 为 厘 米

Printer.ScaleMode = vbCentimeters

LeftMargin = 1.5

HeadTopPosition = 2

' 定 义 打 印 页 左 上 角 的X 坐 标 和Y 坐 标, 通 过 改 变ScaleLeft 和ScaleTop 的 值, 可 改 变 打 印 页 的 左 边 距 和 上 边 距

Printer.ScaleLeft = -LeftMargin

Printer.ScaleTop = -HeadTopPosition

Printer.Font.Name = "Times New Roman"

Printer.Font.Size = 12

Printer.Print "音像店顾客管理系统"

Printer.Print strType

Printer.Print ""

If MyRecordset.EOF And MyRecordset.BOF Then

MsgBox "No Record At Presend!", vbCritical And vbOKOnly, "Print Error"

Exit Sub

End If

MyRecordset.MoveFirst

Do Until Printer.CurrentY FooterTopPosition

'Print the fields of the recordset in sequence

For FieldNum = 0 To MyRecordset.Fields.Count - 1

Printer.Print MyRecordset.Fields(FieldNum).Name _

": " _

MyRecordset.Fields(FieldNum).Value

If Printer.CurrentY FooterTopPosition Then

Printer.CurrentX = 8

Printer.Print "Page: " PageCounter

' 创 建 多 页 文 档

Printer.NewPage

PageCounter = PageCounter + 1

End If

Next FieldNum

MyRecordset.MoveNext

If MyRecordset.EOF Then Exit Do

' 在 记 录 之 间 空 一 行

Printer.Print ""

Loop

'Print the Page number as a footer

Printer.CurrentX = 8

Printer.CurrentY = FooterTopPosition

Printer.Print "Page: " PageCounter

' 将 输 出 送 到 打 印 机

Printer.EndDoc

End Sub


网站名称:vb.net只打印一页 vba 单面打印
转载注明:http://cqcxhl.cn/article/dosiedi.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP