こんにちは、高度な検索フィルターが必要なホームファインダー プロジェクトに参加しています。ユーザーが家賃の金額、場所、性別の種類を選択できる 3 つのドロップダウンリストが必要です。または、データベースに保存されているすべての家を表示するデフォルト値「ALL」があるため、ユーザーは何も選択できませんが、ユーザーがドロップダウンリストから1つまたは2つの値を選択し、他のデフォルト値を「ALL」として選択するか、3つすべてに値がある場合、それらの結合につながるはずです。if文を使ってみた
If (combobox1.text == "ALL" && combobox2.text == "ALL" && combobox3.text == "ALL")
{
// shows all the homes
}
else if ( combobox1.text != "ALL" && combobox2.text == "ALL" && combobox3.text == "ALL")
{
// say combobox1 is rent amount, shows all the homes having that rent amount
}
else if (combobox1.text == "ALL" && combobox2.text != "ALL" && combobox3.text == "ALL")
{
// say combobox2 is gender type shows all the homes having that gender category
if (combox2.text == "Female")
// all homes w "female"
else
// all homes w male
}
else if ( combobox1.text == "ALL" && combobox2.text == "ALL" && combobox3.text != "ALL")
{
// say combobox3 is location, shows all homes in that location
}
else if ( combobox1.text != "ALL" && combobox2.text != "ALL" && combobox3.text != "ALL")
{
}
else if ( combobox1.text != "ALL" && combobox2.text != "ALL" && combobox3.text == "ALL")
{
}
などなど、これは私がこれまで考えてきたコードです:lどうすればそれらの交点を作ることができますか. たとえば、賃料で 500 を選択し、場所で 1 番街を選択した場合、1 番街にある賃料が 500 の住宅を見つけるにはどうすればよいでしょうか?
ところで、私はすでに家を表示する方法を知っています。私の心配は、ドロップダウンリスト内のアイテムの交差点を見つける方法だけです。
あなたからのどんな助けも感謝しています。ありがとうございました