現在、私は各製品のサブフォルダを含む共有ネットワーク上の領域を持っています。特定のサブフォルダを見つける
だから今、フォルダの私の階層は次のようになります。
Test Root Folder <--- This is my master folder
Category 1
Product 1 <--- this is the folder I'm trying to find
Product 2
Product 3
Category 2
Product 6
Product 7
Category 3
Category 4
Product 12
製品のフォルダは、この形式では常に「1234 - 商品1」、私はそれを探していたときに通常、私はそう始まる知っています私はこの例では「1234」を知っていますが、「製品1」のタイトルは「製品1」というタイトルも1234ではありません。
この検索を自動化するにはどうすればよいですか?
これが今の私は、ユーザー例えばtextBox1テキストボックスに数字を入れてする「1234」を期待してい彼らは、ボタン1を打ったときに新しいアイテムが追加されます、これまで
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
namespace HCA
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent(); // For WindowsDesigner DO NOT REMOVE
}
void Button1Click(object sender, EventArgs e)
{
string folderPath = @"C:\Users\Mike\Desktop\YBA Test";
string searchPattern = textBox1.Text & " - *";
DirectoryInfo dir= new DirectoryInfo(folderPath);
DirectoryInfo[] directories =
dir.GetDirectories(searchPattern, SearchOption.AllDirectories);
foreach (DirectoryInfo dir in directories)
{
listBox1.Items.Add(dir.Path);
}
}
void Button2Click(object sender, EventArgs e)
{
listBox2.Items.Clear;
}
}
}
私のコードですディレクトリ "C:\ Users \ユーザーマイク\デスクトップ\ YBAテスト\ CCA ** 1234 - テスト** \" へのハイパーリンクとしてlistbox1を
まず、使用している言語を決めます。 VB.NETはvbaでもVB6でもありません。それはタグでそう正確に言う – Plutonix
ファイルを使ってデータベースを実装することは決して間違いではありません。まずそれに取り組んでください。つまり、Directory.GetDirectories()を使用して "category *"ディレクトリを列挙し、各ディレクトリに対して "1234 *"ディレクトリを列挙します。 –