none
How to hide and show controls on selection changed event in combobox(vb.net)

    Pergunta

  • I have a combobox control. Well on selectionchanged event i want to show "delete" and "edit" button and rest of the time it should be "disabled"

    How do i achieve it?

    Thanks!!!

    sexta-feira, 11 de maio de 2012 20:36

Respostas

  • Hi,

    first off you need to hide your 2 buttons and give them names (I called the buttons btnEdit and btndelete).

    <Button Content="Edit" Name="btnEdit" Height="25" Width="100" Visibility="Hidden" />
    <Button Content="Delete" Name="btnDelete" Height="25" VerticalAlignment="Top" Width="100" />

    then in your selection changed event add these 2 lines of code -

    btnEdit.Visibility = System.Windows.Visibility.Visible
      btnDelete.Visibility = System.Windows.Visibility.Visible

    Hope that helps?

    sexta-feira, 11 de maio de 2012 23:00

Todas as Respostas

  • Hi,

    first off you need to hide your 2 buttons and give them names (I called the buttons btnEdit and btndelete).

    <Button Content="Edit" Name="btnEdit" Height="25" Width="100" Visibility="Hidden" />
    <Button Content="Delete" Name="btnDelete" Height="25" VerticalAlignment="Top" Width="100" />

    then in your selection changed event add these 2 lines of code -

    btnEdit.Visibility = System.Windows.Visibility.Visible
      btnDelete.Visibility = System.Windows.Visibility.Visible

    Hope that helps?

    sexta-feira, 11 de maio de 2012 23:00
  • Thanks :)
    segunda-feira, 14 de maio de 2012 03:32