hi,
i'm working with a travels project i have two tables(vehicle_entry and booking).. when i try to book on some particular date only available vehicle names should be shown in the combo box...
it shold show all the names from vehicle_entry table except that vehicle is registered in booking table on that date.

i tried combo box add item and then remove item but i can't and i used if...else technique after that i searched but still i didnt' get soultion

Here is an example of loading a combobox

Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;")
Dim cmd As New SqlCommand("", con)

cmd.CommandText = "SELECT au_lname FROM authors WHERE city = 'Oakland'"

con.Open()

Dim rdr As SqlDataReader = cmd.ExecuteReader

ComboBox1.Items.Clear()

Do While rdr.Read()
    ComboBox1.Items.Add(rdr("au_lname"))
Loop

rdr.Close()
con.Close()

Just modify the SELECT statement to select the appropriate values from your table.

You need to join the vehicle_entry and booking tables.
Hint: Inner vs. Outer Join
I assume your UI has a calendar(theDate) & the ComboBox (AvailableVehicles).
So the available vehicles (vehicle_entry) for a particular day (where booking.Date == theDate) will NOT have a related booking row.

AvalableVehicles = new ObservableCollection<Vehicle>();
ComboBox1.DataSource = AvalableVehicles;

Change Date:
AvalableVehicles.Clear();
AvalableVehicles = Add all vehicles returned by GetAvalableVehicles(theDate);

Vehicle[] GetAvalableVehicles(DateTime theDate) // query database

Do NOT manipulate the combobox as previously suggested.
ComboBox1.Items BAD

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.