新聞中心
VB.NET 怎樣進(jìn)行按條件搜索?
Private Function SetFilter() As String
專注于為中小企業(yè)提供成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)鹿寨免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
Dim StrFilter As String = ""
If ComboBox_XingBie.Text "全部" Then
StrFilter = String.Format("性別字段 = '{0}'", ComboBox_XingBie.Text)
End If
If StrFilter "" Then StrFilter = " and "
If TextBox_XingMing.Text "" Then
StrFilter = String.Format("姓名字段 = '{0}'", TextBox_XingMing.Text)
End If
If StrFilter "" Then StrFilter = " and "
If CheckBox_AiHao.Checked = True Then
StrFilter = String.Format("愛好字段 = '{0}'", CheckBox_AiHao.Text)
End If
Return StrFilter
End Function
Private Sub CheckBox_AiHao_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles CheckBox_AiHao.CheckedChanged, TextBox_XingMing.TextChanged, ComboBox_XingBie.SelectedIndexChanged
數(shù)據(jù)表指針.filter = SetFilter()
End Sub
vb.net關(guān)鍵字搜索文件
窗體上添加一個文本框,一個列表框,一個按鈕:
代碼如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyDir As String = "C:\123"
Dim MyFilter As String = "*" TextBox1.Text "*"
ListBox1.Items.Clear()
For Each MyFile As String In System.IO.Directory.GetFiles(MyDir, MyFilter)
ListBox1.Items.Add(MyFile)
Next
End Sub
vb.net查找未使用的函數(shù)
您是想問vb.net查找未使用的函數(shù)方法嗎?vb.net查找未使用的函數(shù)方法是:
1、在VS.NET中右鍵單擊主RESX文件,然后從上下文菜單中選擇FindUsages。
2、雙擊解決方案窗口中的每個匹配項(xiàng),這將打開包含該資源的源代碼窗口。
3、在源代碼窗口中重命名此資源,它將彈出ReSharper的“重命名資源”對話框。
4、它將重命名資源和自動生成的C#包裝器/訪問類。
5、對"Usages“窗口中的所有資源重復(fù)上述步驟2、3和4。
6、在VisualStudio的資源編輯器中打開RESX文件,并選擇所有不帶前綴的文件。
7、您最終得到了一個RESX文件,其中有未使用的函數(shù)。
vb.net 搜索子目錄下的文件
vb.net編程查找搜索指定目錄下面的所有文件和其子目錄下的文件,方法如下:
''=============================================
''名稱:?FindPath
''作用:?查找搜索指定目錄下面的所有文件和其子目錄下的文件
''參數(shù):strPath?要查找的目錄,
''strFiles?用于存查找結(jié)果的緩沖區(qū),String?類型的動態(tài)數(shù)組,調(diào)用時事先初始化,?如Redim?strFiles(0)
''FileCount?用于返回文件個數(shù)
''=============================================
Public?Sub?FindPath(ByVal?strPath?As?String,?strFiles()?As?String,?FileCount?As?Long)
Dim?strDirs()???As?String
Dim?strResult???As?String
Dim?FileLimit???As?Long
Dim?dirLimit????As?Long
Dim?dirCount????As?Long
Dim?I???????????As?Long
FileLimit?=?UBound(strFiles)?+?1
dirLimit?=?0
If?Right$(strPath,?1)??"/"?Then?strPath?=?strPath??"/"
strResult?=?Dir(strPath,?vbDirectory?+?vbSystem?+?vbReadOnly?+?vbHidden?+?vbNormal?+?vbArchive)
Do?While?Len(strResult)??0
If?strResult??"."?And?strResult??".."?Then
If?(GetAttr(strPath??strResult)?And?vbDirectory)??vbDirectory?Then
If?FileCount?=?FileLimit?Then
ReDim?Preserve?strFiles(FileLimit?+?10)
FileLimit?=?FileLimit?+?10
End?If
strFiles(FileCount)?=?strPath??strResult
FileCount?=?FileCount?+?1
Else
If?dirCount?=?dirLimit?Then
ReDim?Preserve?strDirs(dirLimit?+?10)
dirLimit?=?dirLimit?+?10
End?If
strDirs(dirCount)?=?strPath??strResult
dirCount?=?dirCount?+?1
End?If
End?If
strResult?=?Dir(,?vbDirectory?+?vbSystem?+?vbReadOnly?+?vbHidden?+?vbNormal?+?vbArchive)
Loop
For?I?=?0?To?dirCount?-?1
Call?FindPath(strDirs(I),?strFiles,?FileCount)
Next?I
End?Sub
vb.net 如何用通配符查找文件
步驟如下:
窗體上添加2個列表框,一個按鈕:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyDir As String = "C:\123"
'搜索并顯示子文件夾
ListBox1.Items.Clear()
For Each MySubDir As String In System.IO.Directory.GetDirectories(MyDir)
ListBox1.Items.Add(MySubDir)
Next
'搜索并顯示文件
ListBox2.Items.Clear()
For Each MyFile As String In System.IO.Directory.GetFiles(MyDir)
ListBox2.Items.Add(MyFile)
Next
End Sub
End Class
新聞名稱:vb.net搜索 vb search
轉(zhuǎn)載來于:http://www.ef60e0e.cn/article/dodjgoc.html