我正在开发一个逐行获取文本框索引的项目。 因此,当我单击按钮时,Start会读取文本索引,列表框会打印它。最后,我将使列表框可见性为false,然后在fastreport中显示文本索引。我想要克服的是计时器没有运行。
另一方面,假设我的文本文件中有10个行集合。通过使用ReadLine属性,编译器因第11个元素而停止。我该如何处理这个问题。
这是我的代码。
Public Class Form1
Dim _report As Report
Dim val As StreamReader
Dim fs As FileStream
Dim second As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
fs = New FileStream("tf.txt", FileMode.Open, FileAccess.Read)
val = New StreamReader(fs)
Timer1.Interval = 5000
End Sub
Private Sub FileButton_Click(sender As Object, e As EventArgs) Handles FileButton.Click
If (ListBox1.SelectedIndex) Then
ListBox1.Items.Add(val.ReadLine)
End If
Timer1.Start()
'_report.Load("file.frx")
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ListBox1.Text = DateTime.Now.ToString
second = second + 1
If second >= 5 Then
Timer1.Stop()
End If
End Sub
答案 0 :(得分:0)
尝试使用Microsoft的Reactive Framework(NuGet“Rx-WinForms”):
LAST_INSERT_ID()