Hey, Im creating a SQL application using visual Studio and C#. I have a comboBox in the application which allows the user to input what colnum they would like to delete from a perticular table. Im getting this error - Error Cannot implicitly convert type 'int' to 'bool' Here is the code for the ComboBox -
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (delTable.SelectedIndex = 0)
{
ColName.Items.Clear();
ColName.Items.Add("TennentId");
ColName.Items.Add("Firstname");
ColName.Items.Add("Lastname");
ColName.Items.Add("Address");
ColName.Items.Add("City");
ColName.Items.Add("Postcode");
ColName.Items.Add("Contactno");
ColName.Items.Add("HouseId");
}
if (delTable.SelectedIndex = 1)
{
ColName.Items.Clear();
ColName.Items.Add("arrearId");
ColName.Items.Add("Firstname");
ColName.Items.Add("Lastname");
ColName.Items.Add("contactno");
ColName.Items.Add("HouseId");
}
if (delTable.SelectedIndex = 2)
{
ColName.Items.Clear();
ColName.Items.Add("HouseId");
ColName.Items.Add("Housename");
ColName.Items.Add("Address");
ColName.Items.Add("City");
ColName.Items.Add("Postcode");
ColName.Items.Add("housePhoneNo");
}
}
The errors come up on thease lines - if (delTable.SelectedIndex = 0)
Here is the XAML for the ComboBox -
Any help out there?
Thank you.
VulpesPosted Jun 24, 2014, 4:54 PM
So the first one should be:
if (delTable.SelectedIndex == 0)