林老师,界面如上图所示,代码如下:
'根据权限加载数据按钮
ClientList_BtnAll_Click
Dim filter As String
Select Case CustomerManageRead ‘全局变量-权限代码
Case "0"
filter = "_Identify IS Null"
Case "1"
filter = "SalesmanID = '" & TmpUserID & "' and PubCus = 0"
Case "2"
filter = "SalesDepartmentID = '" & TmpDepartmentID & "' and PubCus = 0"
Case "3"
filter = "SalesDepartmentID like '" & TmpDepartmentID & "%' and PubCus = 0"
Case "4"
Dim s1 As String = TmpDepartmentID.SubString(0,2)
filter = "SalesDepartmentID like '" & s1 & "%' and PubCus = 0"
Case "5"
filter = "PubCus = 0"
End Select
Dim filter2 As String = ""
With DataTables("DA_Customer")
.LoadFilter = filter
End With
e.Form.Controls("TextBox1").value = TmpPagesize
Dim BtnFirst As WinForm.Button = e.Form.Controls("BtnOK")
BtnFirst.performclick()
e.Sender.Enabled = False
ClientList_BtnOK_Click
Dim TextBox1 As Integer = e.Form.Controls("TextBox1").value
If TextBox1 = 0 Or e.Form.Controls("TextBox1").value = "" Then
TextBox1 = tmppagesize 'tmppagesize 是分页大小的全局变量,Int型,用户自行设置,一般默认值为100
e.Form.Controls("TextBox1").value = tmppagesize
End If
tmppagesize = TextBox1
With DataTables("Da_Customer")
.LoadTop = tmppagesize
.loadpage = 0
.Load()
e.Form.Controls("Label1").text = "第" & .LoadPage + 1 & "/" & .TotalPages & "页" & .DataRows.Count
If .loadpage > 0 Then
e.Form.Controls("BtnFirst").Enabled = True
e.Form.Controls("Btnprevious").Enabled = True
Else
e.Form.Controls("BtnFirst").Enabled = False
e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages - 1 > .loadpage Then
e.Form.Controls("BtnNext").Enabled = True
e.Form.Controls("BtnLast").Enabled = True
Else
e.Form.Controls("BtnNext").Enabled = False
e.Form.Controls("BtnLast").Enabled = False
End If
End With
'首页
ClientList_BtnFirst_Click
With DataTables("DA_customer")
If .LoadPage <> 0 Then
.LoadTop = tmppagesize
.LoadPage = 0
.Load()
End If
e.Form.Controls("Label1").text = "第" & DataTables("DA_Customer").LoadPage+1 & "/" & DataTables("DA_Customer").TotalPages & "页"
If .loadpage > 0 Then
e.Form.Controls("BtnFirst").Enabled = True
e.Form.Controls("Btnprevious").Enabled = True
Else
e.Form.Controls("BtnFirst").Enabled = False
e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
e.Form.Controls("BtnNext").Enabled = True
e.Form.Controls("BtnLast").Enabled = True
Else
e.Form.Controls("BtnNext").Enabled = False
e.Form.Controls("BtnLast").Enabled = False
End If
End With
’末页
ClientList_BtnLast_Click
With DataTables("DA_customer")
If .LoadPage < .TotalPages - 1 Then
.LoadPage = .TotalPages - 1
.Load()
End If
e.Form.Controls("Label1").text = "第" & DataTables("DA_Customer").LoadPage+1 & "/" & DataTables("DA_Customer").TotalPages & "页"
If .loadpage > 0 Then
e.Form.Controls("BtnFirst").Enabled = True
e.Form.Controls("Btnprevious").Enabled = True
Else
e.Form.Controls("BtnFirst").Enabled = False
e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
e.Form.Controls("BtnNext").Enabled = True
e.Form.Controls("BtnLast").Enabled = True
Else
e.Form.Controls("BtnNext").Enabled = False
e.Form.Controls("BtnLast").Enabled = False
End If
End With
‘下一页
ClientList_BtnNext_Click
With DataTables("DA_customer")
If .LoadPage < .TotalPages - 1 Then
.LoadPage = .LoadPage + 1
.Load()
End If
e.Form.Controls("Label1").text = "第" & DataTables("DA_Customer").LoadPage+1 & "/" & DataTables("DA_Customer").TotalPages & "页"
If .loadpage > 0 Then
e.Form.Controls("BtnFirst").Enabled = True
e.Form.Controls("Btnprevious").Enabled = True
Else
e.Form.Controls("BtnFirst").Enabled = False
e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
e.Form.Controls("BtnNext").Enabled = True
e.Form.Controls("BtnLast").Enabled = True
Else
e.Form.Controls("BtnNext").Enabled = False
e.Form.Controls("BtnLast").Enabled = False
End If
End With
’上一页
ClientList_Btnprevious_Click
With DataTables("DA_customer")
If .LoadPage > 0 Then
.LoadPage = .LoadPage - 1
.Load()
End If
e.Form.Controls("Label1").text = "第" & .LoadPage+1 & "/" & .TotalPages & "页"
If .loadpage > 0 Then
e.Form.Controls("BtnFirst").Enabled = True
e.Form.Controls("Btnprevious").Enabled = True
Else
e.Form.Controls("BtnFirst").Enabled = False
e.Form.Controls("Btnprevious").Enabled = False
End If
If .TotalPages-1 > .loadpage Then
e.Form.Controls("BtnNext").Enabled = True
e.Form.Controls("BtnLast").Enabled = True
Else
e.Form.Controls("BtnNext").Enabled = False
e.Form.Controls("BtnLast").Enabled = False
End If
End With
[此贴子已经被作者于2013-2-17 9:27:08编辑过]