谁能给出一段搜索代码,用VB写的。谢谢了。按关键字搜索功能!

如题所述

Option Explicit

Private Sub Command1_Click()
Dim n As String
n = InputBox("输入路径", , "C:\")
File1.Path = n
File1.Pattern = "*"
End Sub

Private Sub Command2_Click()
Dim n As String
n = InputBox("输入关键字", , "*")
File1.Pattern = "*" & n & "*"
End Sub

Private Sub File1_Click()
Shell "c:\windows\system32\cmd.exe /c start """" """ & File1.Path & "\" & File1.List(File1.ListIndex) & """"
End Sub

Private Sub Form_Load()
Command1.Caption = "显示内容"
Command2.Caption = "查找文件"
File1.Pattern = "%%%%%%%%"
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-08-13
/// <summary>
/// 对Grieview进行条件搜索
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ButSS_Click(object sender, EventArgs e)
{
try
{
if (RdRKR.Checked)
//根据入库人进行搜索
BandGrv("StoringName like '%" + this.TxtSS.Text);
//StoringName是数据库里的字段,txtss是文本框里要搜索的内容
else if (RdGYS.Checked)
//根据供应商进行搜索
BandGrv("PartSupplier like '%" + this.TxtSS.Text);

}
catch (Exception ex)
{
throw ex;
}
}
相似回答