所以感谢Mych完成了我的DateTimePicker!还有我们老师要我们做的另一个问题。使用两个DateTimePicker从范围获取结果后,我们需要打印结果。这是我的代码。 If Then语句似乎存在问题。
错误说明:
运营商' ='未定义类型' DataTable'并输入' BindingSource'。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim dt As New DataTable
If dt = DataGridView1.DataSource Then
PrintPreviewDialog1.ShowDialog()
End If
End Sub
Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
e.Graphics.DrawString(DataGridView1.DataSource, Font, Brushes.Black, 100, 100)
End Sub