乍看难点是本月日期提取,下面是代码
创新互联建站网站建设公司,提供网站建设、网站制作,网页设计,建网站,PHP网站建设等专业做网站服务;可快速的进行网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,是专业的做网站团队,希望更多企业前来合作!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim date_start As Date = DateTimePicker1.Value.Year "-" DateTimePicker1.Value.Month '本月的开始日期(包含)
Dim date_end As Date = DateTimePicker1.Value.Year "-" DateTimePicker1.Value.Month
date_end = date_end.AddMonths(1) '本月的终止日期(不包含)
Dim str As String = "selcet * from 数据表 where 日期=#" date_start "# and 日期#" date_end "#" '这里是查询表达式
End Sub
如果想继续编辑之前的文档,在TXT文件尾部继续添加文本,那么还需要在函数后边加个参数。
VB 代码
方法1:
Dim sw As StreamWriter = New StreamWriter("C:\temp\test.txt")
sw.Write("abc" vbCrLf)
sw.Close()
Dim sw2 As StreamWriter = New StreamWriter("C:\temp\test.txt", True)
sw2.Write("456" vbCrLf)
sw2.Close()
方法2:
My.Computer.FileSystem.WriteAllText("test.txt", "This is test Text", True)
方法3:
System.IO.File.AppendAllText("c:\temp\test.txt", "this is extra test file")
详见:“网页链接”
vb.net里有个,可以做历史记录的,象google那样的.
vb6只是存到别处,下次一行行的读取然后 combo.additem 内容即可
例:注册表
Private Sub Form_Load()
AddandLoad ""
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 And Shift = 0 Then
AddandLoad Combo1.Text '先在这里触发了,如果你要在别处,只要移动这一行
End If
End Sub
Sub AddandLoad(ByVal s As String)
Dim s1 As String
Dim i As Long
Dim b As Boolean
Do
i = i + 1
s1 = GetSetting(App.Title, "history", "h" i, "")
If Len(s1) = 0 Then Exit Do
b = b Or LCase(s) = LCase(s1)
Me.Combo1.AddItem s1
Loop
If Not b Then
If Len(s) 0 Then
SaveSetting App.Title, "history", "h" i, s
Me.Combo1.AddItem s
End If
End If
End Sub