在组合框列表项目选择用户控制应该激活。 [英] on combo box list item selection user contol should get active.

查看:42
本文介绍了在组合框列表项目选择用户控制应该激活。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vb.net上有一个窗口申请表

我有一个包含3个项目列表的组合框。

选择任何一个项目时,它应该激活表格上各自的用户控制。



谢谢



改进了que ..?



我有一个带有三个项目和三个用户控件的组合框的窗体。

因为我从组合框列表中选择了1项,其各自的用户控制应该是活动的。

和其余两个用户控件将处于非活动状态

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

推荐答案



下面的代码显示如何根据组合框中的项目选择激活/停用(启用/禁用)按钮。



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





希望这对你有帮助!



最好的问候
Muthuraja



Hope this helps for you!.

Best Regards
Muthuraja


这篇关于在组合框列表项目选择用户控制应该激活。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆