Click here to Skip to main content
12,395,378 members (56,077 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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 28-Jan-13 23:36pm
Updated 29-Jan-13 0:28am
v2
Comments
CHill60 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2016
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