⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.frm

📁 VB做的一个短信收发的例子,功能比较强大,可以好好参考
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form Dialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "已发送短消息"
   ClientHeight    =   5895
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6900
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5895
   ScaleWidth      =   6900
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command3 
      Caption         =   "上一页"
      Height          =   390
      Left            =   840
      TabIndex        =   2
      Top             =   5370
      Width           =   885
   End
   Begin VB.CommandButton Command4 
      Caption         =   "下一页"
      Height          =   375
      Left            =   1935
      TabIndex        =   1
      Top             =   5370
      Width           =   900
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "退出"
      Height          =   375
      Left            =   4470
      TabIndex        =   0
      Top             =   5370
      Width           =   900
   End
   Begin MSFlexGridLib.MSFlexGrid MSGrid1 
      Height          =   5205
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   6810
      _ExtentX        =   12012
      _ExtentY        =   9181
      _Version        =   393216
      Rows            =   21
      Cols            =   4
      FixedCols       =   0
      FormatString    =   "  序  号  |       号                  码              |               内                             容  |   状      态"
   End
   Begin VB.Label Label4 
      Caption         =   "当前为第1页"
      Height          =   285
      Left            =   3090
      TabIndex        =   4
      Top             =   5415
      Width           =   1080
   End
End
Attribute VB_Name = "Dialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim CURpage As Integer
Dim Rd As ADODB.Recordset
Private Sub CancelButton_Click()
Unload Me
End Sub

Private Sub Command3_Click()
 CURpage = listInGrid(CURpage - 1)
 Label4.Caption = "当前为第" & CURpage & "页"
End Sub

Private Sub Command4_Click()
 CURpage = listInGrid(CURpage + 1)
 Label4.Caption = "当前为第" & CURpage & "页"
End Sub

Private Function listInGrid(Optional ByVal pageno As Integer = 1) As Integer
 '
 Dim i As Integer
  Rd.Open "select * from smssend order by id desc", conn, 1, 1
 i = 1
 Dim s As String
 s = MSGrid1.FormatString
 
 MSGrid1.Clear
 MSGrid1.FormatString = s
 If Not (Rd.BOF And Rd.EOF) Then
   Rd.PageSize = 20
   If pageno < 1 Then pageno = 1
   If pageno > Rd.PageCount Then
 
    pageno = Rd.PageCount
   End If
   Rd.AbsolutePage = pageno
  
   
   Do While i <= 20 And Not Rd.EOF
     
       MSGrid1.TextMatrix(i, 0) = i + (pageno - 1) * Rd.PageSize
       MSGrid1.TextMatrix(i, 1) = Rd("sms_num") & ""
       MSGrid1.TextMatrix(i, 2) = Rd("sms_nr") & ""
       If Rd("sms_reportsj") <> "" Then
         MSGrid1.TextMatrix(i, 3) = "送达"
       
         ElseIf Rd("sms_state") = "2" Then
         MSGrid1.TextMatrix(i, 3) = "发送中"
         ElseIf Rd("sms_state") = "1" Then
         MSGrid1.TextMatrix(i, 3) = "已发"
         ElseIf Rd("sms_state") = "0" Then
         MSGrid1.TextMatrix(i, 3) = "未发"
       End If
   i = i + 1
   Rd.MoveNext
   Loop
      
   
   
 Else
 End If
 Rd.Close
 listInGrid = pageno

End Function

Private Sub Form_Load()
 
 Set Rd = New ADODB.Recordset
 
 CURpage = listInGrid(1)
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set Rd = Nothing
  
  
End Sub

Private Sub MSGrid1_DblClick()
If MSGrid1.Row > 0 And MSGrid1.TextMatrix(MSGrid1.Row, 1) <> "" Then
     MsgBox "号码:" & MSGrid1.TextMatrix(MSGrid1.Row, 1) & vbCrLf & "内容:" & MSGrid1.TextMatrix(MSGrid1.Row, 2), vbInformation, "发送的短消息"
     Else
  End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -