Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
I have a window application form on vb.net
I have a combo box with 3 items list.
on selection of any one item ,it should active the respective user control on the form.
 
thanks
 
Improved que..?
 
I have a windows form with a combo box with three items and three users controls.
as i select 1 item from the combo box list, its respective user control should be active.
and rest two user controls will be inactive
Posted 29-Jan-13 0:36am
Edited 29-Jan-13 1:28am
v2
Comments
CHill60 at 29-Jan-13 6:32am
   
Still not quite a question - are you asking us how to write the code to do this? Have you tried anything yet? If so then post your code. If not then have a go first
CPallini at 29-Jan-13 6:33am
   
And your problem is?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
Below code show how to activate / deactivate (Enable/disable) button based on the item selection in combobox.
 
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If (ComboBox1.SelectedIndex <> -1) Then
            If (ComboBox1.Text = "One") Then
                Button1.Enabled = True
                Button2.Enabled = False
                Button3.Enabled = False
            ElseIf (ComboBox1.Text = "Two") Then
                Button1.Enabled = False
                Button2.Enabled = True
                Button3.Enabled = False
            ElseIf (ComboBox1.Text = "Three") Then
                Button1.Enabled = False
                Button2.Enabled = False
                Button3.Enabled = True
            End If
        End If
    End Sub
 
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Button1.Enabled = False
        Button2.Enabled = False
        Button3.Enabled = False
    End Sub
 
Hope this helps for you!.
 
Best Regards
Muthuraja
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 400
1 Maciej Los 222
2 OriginalGriff 213
3 BillWoodruff 130
4 Zoltán Zörgő 85
0 OriginalGriff 7,969
1 DamithSL 6,139
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,309
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100