要求从一个文本文件中读入身份证号码,然后在表单上循环快速显示,这时按下回车,或者单击鼠标,停止号码循环显示,并在表单下边显示选出的号码。要求程序中要有详尽的注释,这一点很重要,因为以后本人可能要改动!
最后说一句:本人一定给分,先在这里谢谢各位了!

解决方案 »

  1.   

    我写一个,新建一个文本文件,文件名为data.txt,往里输入点数据,如下320111123456789
    220111345678910
    110214578412412
    330124787451210
    658745124784121
    958741257485214把以下代码保存为form1.frm,用VB打开即可VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   2160
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   4680
       LinkTopic       =   "Form1"
       ScaleHeight     =   2160
       ScaleWidth      =   4680
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command2 
          Caption         =   "Start"
          Height          =   495
          Left            =   1200
          TabIndex        =   2
          Top             =   1440
          Width           =   1215
       End
       Begin VB.Timer Timer1 
          Enabled         =   0   'False
          Interval        =   100
          Left            =   720
          Top             =   1440
       End
       Begin VB.TextBox Text1 
          Height          =   615
          Left            =   600
          TabIndex        =   1
          Text            =   "Text1"
          Top             =   480
          Width           =   3375
       End
       Begin VB.CommandButton Command1 
          Caption         =   "Stop"
          Height          =   495
          Left            =   2520
          TabIndex        =   0
          Top             =   1440
          Width           =   1215
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Dim DataArray() As String
    Dim k As Long
    Private Sub Command1_Click()
    Timer1.Enabled = False
    End SubPrivate Sub Command2_Click()
    Timer1.Enabled = True
    End SubPrivate Sub Form_Load()
    LoadData
    End SubPrivate Sub Timer1_Timer()Randomize
    k = Int((UBound(DataArray) - 1 + 1) * Rnd + 1)
    Text1.Text = DataArray(k)End Sub
    Sub LoadData()
    Dim i As Long, j As Long
    Dim ReadData As String
      Open App.Path + "\data.txt" For Input As #1
    dd:      Do Until EOF(1)
             Line Input #1, ReadData
             If ReadData = "" Then
             GoTo dd
             End If
             i = i + 1
            Loop
            Close #1
       ReDim DataArray(i)
      Open App.Path + "\data.txt" For Input As #1
    bb:      Do Until EOF(1)
             Line Input #1, ReadData
             If ReadData = "" Then
             GoTo bb
             End If
             DataArray(j) = ReadData
             j = j + 1
            Loop
            Close #1End Sub
      

  2.   

    你真是苛刻啊,我还是加完整吧,否则一点分都没有了:(...VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   3615
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   5250
       LinkTopic       =   "Form1"
       ScaleHeight     =   3615
       ScaleWidth      =   5250
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command2 
          Caption         =   "Start"
          Height          =   495
          Left            =   1200
          TabIndex        =   2
          Top             =   1440
          Width           =   1215
       End
       Begin VB.Timer Timer1 
          Enabled         =   0   'False
          Interval        =   100
          Left            =   720
          Top             =   1440
       End
       Begin VB.TextBox Text1 
          Height          =   615
          Left            =   600
          TabIndex        =   1
          Text            =   "Text1"
          Top             =   480
          Width           =   3375
       End
       Begin VB.CommandButton Command1 
          Caption         =   "Stop"
          Height          =   495
          Left            =   2520
          TabIndex        =   0
          Top             =   1440
          Width           =   1215
       End
       Begin VB.Label Label1 
          Caption         =   "Label1"
          Height          =   495
          Left            =   120
          TabIndex        =   3
          Top             =   0
          Width           =   4335
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Dim DataArray() As String
    Dim k As Long
    Private Sub Command1_Click()
    Timer1.Enabled = False
    End SubPrivate Sub Command2_Click()
    Timer1.Enabled = True
    End SubPrivate Sub Form_Load()
    LoadData
    End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Timer1.Enabled = False
        Label1.Caption = Text1.Text
    End If
    End SubPrivate Sub Label1_Click()End SubPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Timer1.Enabled = False
        Label1.Caption = Text1.Text
    End If
    End SubPrivate Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Timer1.Enabled = False
        Label1.Caption = Text1.Text
    End If
    End SubPrivate Sub Timer1_Timer()Randomize
    k = Int((UBound(DataArray) - 1 + 1) * Rnd + 1)
    Text1.Text = DataArray(k)End Sub
    Sub LoadData()
    Dim i As Long, j As Long
    Dim ReadData As String
      Open App.Path + "\data.txt" For Input As #1
    dd:      Do Until EOF(1)
             Line Input #1, ReadData
             If ReadData = "" Then
             GoTo dd
             End If
             i = i + 1
            Loop
            Close #1
       ReDim DataArray(i)
      Open App.Path + "\data.txt" For Input As #1
    bb:      Do Until EOF(1)
             Line Input #1, ReadData
             If ReadData = "" Then
             GoTo bb
             End If
             DataArray(j) = ReadData
             j = j + 1
            Loop
            Close #1End Sub
      

  3.   

    源码都贴出来了,你不会自己改改啊,呵呵!
    VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   3615
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   5250
       LinkTopic       =   "Form1"
       ScaleHeight     =   3615
       ScaleWidth      =   5250
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command2 
          Caption         =   "Start"
          Height          =   495
          Left            =   1200
          TabIndex        =   2
          Top             =   1440
          Width           =   1215
       End
       Begin VB.Timer Timer1 
          Enabled         =   0   'False
          Interval        =   100
          Left            =   720
          Top             =   1440
       End
       Begin VB.TextBox Text1 
          Height          =   615
          Left            =   600
          TabIndex        =   1
          Text            =   "Text1"
          Top             =   480
          Width           =   3375
       End
       Begin VB.CommandButton Command1 
          Caption         =   "Stop"
          Height          =   495
          Left            =   2520
          TabIndex        =   0
          Top             =   1440
          Width           =   1215
       End
       Begin VB.Label Label1 
          Caption         =   "号码为:"
          Height          =   495
          Left            =   240
          TabIndex        =   3
          Top             =   2400
          Width           =   4335
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Dim DataArray() As String
    Dim k As Long
    Private Sub Command1_Click()
    Timer1.Enabled = False
    Label1 = "号码为:" & Text1.Text
    End SubPrivate Sub Command2_Click()
    Timer1.Enabled = True
    End SubPrivate Sub Form_Load()
    LoadData
    End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Timer1.Enabled = False
        Label1 = "号码为:" & Text1.Text
    End If
    End SubPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Timer1.Enabled = False
        Label1.Caption = Text1.Text
    End If
    End SubPrivate Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Timer1.Enabled = False
        Label1.Caption = Text1.Text
    End If
    End SubPrivate Sub Timer1_Timer()Randomize
    k = Int((UBound(DataArray) - 1 + 1) * Rnd + 1)
    Text1.Text = DataArray(k)End Sub
    Sub LoadData()
    Dim i As Long, j As Long
    Dim ReadData As String
      Open App.Path + "\data.txt" For Input As #1
    dd:      Do Until EOF(1)
             Line Input #1, ReadData
             If ReadData = "" Then
             GoTo dd
             End If
             i = i + 1
            Loop
            Close #1
       ReDim DataArray(i)
      Open App.Path + "\data.txt" For Input As #1
    bb:      Do Until EOF(1)
             Line Input #1, ReadData
             If ReadData = "" Then
             GoTo bb
             End If
             DataArray(j) = ReadData
             j = j + 1
            Loop
            Close #1End Sub
      

  4.   

    我有个java的应用程序要么? 不过运行慢点,还可以吧,不能很好的支持打印!