作者:fx_blog(csdn)
日期:2005-5-22
标题:威人留言录(v1.8)
注意:转贴一定注明作者及出处
*****************************************开始****************************
现在来完成第五部分,留言查询*******
首先新建一个窗体
大家自己建吧,现在应该是form6了
双击”查询留言”按钮
写入以下代码(form6内的控件都要设置好)
if textbox3.text = “” then
messagebox.show(“请输入搜索关键字”)
exit sub
end if
dim searchform as new form6
searchform.textbox1.text = me.textbox3.text
searchform.show()
现在回到form6窗体
首先进入form6_load(…)
写入以下代码….
me.text = “查询留言-关键字: ” & textbox1.text
dim doc as xmldocument = new xmldocument
doc.load(“info.xml”)
dim match as string
match = textbox1.text
dim regular as regex = new regex(match)
dim liuyuaninfo as xmlnodelist
liuyuaninfo = doc.getelementsbytagname(“userliuyuan”)
dim i as integer
textbox1.text += “以下是相似的记录” & vbcrlf
textbox1.text += “==================================” & vbcrlf
for i = 0 to userid.count – 1
while regular.ismatch(liuyuaninfo(i).innertext)
textbox1.text += “留言: ” & liuyuaninfo(i).innertext & vbcrlf
textbox1.text += “=======================================” & vbcrlf
exit while
end while
next
现在双击”关键字查询”按钮
输入以下代码(其实和上面的一模一样)
me.text = “查询留言-关键字: ” & textbox1.text
dim doc as xmldocument = new xmldocument
doc.load(“info.xml”)
dim match as string
match = textbox1.text
dim regular as regex = new regex(match)
dim liuyuaninfo as xmlnodelist
liuyuaninfo = doc.getelementsbytagname(“userliuyuan”)
dim i as integer
textbox1.text += “以下是相似的记录” & vbcrlf
textbox1.text += “==================================” & vbcrlf
for i = 0 to userid.count – 1
while regular.ismatch(liuyuaninfo(i).innertext)
textbox1.text += “留言: ” & liuyuaninfo(i).innertext & vbcrlf
textbox1.text += “=======================================” & vbcrlf
exit while
end while
next
好了查询功能完成了,到现在为止,五部分已经全部完成.