RunDown BassMan

RunDown BassMan

  • NA
  • 22
  • 28.8k

ComboBox variable types error

Jun 23 2014 9:05 AM
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 - 
 
<ComboBox x:Name="delTable" HorizontalAlignment="Left" Margin="573,52,0,0" Grid.Row="1" VerticalAlignment="Top" Width="120" SelectionChanged="ComboBox_SelectionChanged">
<ComboBoxItem Content="Tennents" />
<ComboBoxItem Content="Arrears" />
<ComboBoxItem Content="Houses" />
</ComboBox>
 
Any help out there?
Thank you.

Answers (1)