- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Visual Studio 2005 在 VB.NET 中进行开发。
我在 Load 方法中填充的表单上有一个 ComboBox (myCombo)。
我还处理了 myCombo.SelectedIndexChanged 以更改表单上的标签。
编辑:我添加事件处理程序的方式是双击设计器上的组合框。然后在代码 View 中出现了骨架代码。
看起来发生的事情是当表单加载时,每次将项目添加到 myCombo 时都会触发 SelectedIndexChanged。
这不是我想要的,但我认为还有另一个事件处理程序只有在用户更改选择时才会被调用。
这是我所拥有的一些代码:
Private Sub myDlg_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' this is all I do with myCombo in this sub
list = GetListOfItemsToAdd()
myCombo.DataSource = list
myCombo.DisplayMember = "DisplayMember"
myCombo.ValueMember = "ValueMember"
End Sub
AddHandler myCombo.SelectedIndexChanged, AddressOf myCombo_SelectedIndexChanged
最佳答案
SelectionChangeCommitted 是当用户更改 ComboBox 选择时调用的事件处理程序。
来自 SelectionChangeCommitted 的 MSDN 文档:
SelectionChangeCommitted is raised only when the user changes the combo box selection. Do not use SelectedIndexChanged or SelectedValueChanged to capture user changes, because those events are also raised when the selection changes programmatically.
关于.net - 不会在表单加载时触发的 SelectedIndexChanged 替代方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1956081/
我的代码: *.aspx: *.aspx.cs: protected void Page_Load(object sender, EventArgs e) { CountryList.Sele
我有点陷入实现困境。 我正在将 Windowsforms 与 Oracle 数据库结合使用 我有一个包含很多控件的页面,包括带有子程序(A、B、C..)的 DropDownList、一组 CheckB
我使用 C# 使用 ASP.NET WebForms。单击它创建一个下拉列表时,我有一个按钮。这个列表是在“createlist”方法中使用 id 和 items 等参数创建的。我还添加了一个 Sel
如何在索引更改之前处理组合框选择的索引事件? Winforms 不提供任何类型的 ComboBox.SelectedIndexChanging 事件! 谢谢 最佳答案 I achieved it us
当用户更改我的网格中 DataGridViewComboBoxColumn 的值时,我需要执行一个操作。假设我必须显示一条消息。 问题是 messagebox.show("hello") 代码执行了数
我正在处理 onSelectIndexChanged 事件。当 DropDownList 选择更改时会引发一个事件。问题是 DropDownList 仍然返回 SelectedValue 和 Sele
我有以下简单代码:
我有一个结构如下的表单应用程序: +--------------------------------------------------------------+ | FormMain
我想找到父转发器,其中包含子转发器和子转发器包含下拉列表。在 Drowndownlist 的 SelectedIndexChange 上,我想找出父转发器。找到parent repeater后,想找到
我正在使用 Visual Studio 2005 在 VB.NET 中进行开发。 我在 Load 方法中填充的表单上有一个 ComboBox (myCombo)。 我还处理了 myCombo.Sele
我正在尝试以编程方式将未指定数量的新用户控件添加到表单中。每次在包含在 UserControl 中的 ComboBox 中选择一个条目时,都会添加一个。 问题是,SelectedIndexChange
我正在使用 Vb.net 在 asp.net 网站上工作,我有一个带有 autopostback = true 的下拉列表,我需要在更改项目时获取选定的值,或者我想获取触发 selectedindex
我在一个只有 listbox 的 winforms 后面有这个代码作为其唯一控制: Imports System.Windows.Forms Public Class Form1 Public
我的页面上有一个下拉列表和网格。更改下拉值时,网格会刷新。绑定(bind)到网格的数据是从数据库中获取的。当我更改下拉值时,我应该能够看到加载屏幕上的图像。加载数据后,加载图像应该消失。我将如何实现这
我有一个带有 ComboBox 的表单,它提供了一个下拉列表。在组合框的 SelectedIndexChanged 事件 上,我正在运行一些代码,但我不希望在加载表单时运行该代码。不幸的是,当我加载表
我有一个下拉列表(dr1),它应该在不影响 dr3 的情况下触发 dr2 的更新。问题是 dr1 触发更新,但没有进入 dr1_SelectedIndexChanged。我知道这是因为标签不会改变并且
在用户根据他们选择的内容选择第一个所需的下拉列表后,我正在使用两个下拉框,另一个下拉列表将加载最终列表。我有这个工作但是我不希望页面在选择第一个下拉选项后重新加载是否有解决方法下面是我的测试代码 Be
我有一个生成的复选框列表,它是通过选择另一个复选框列表上的选项生成的: CheckBoxList typefilter = new CheckBoxList { ID = "typefilter" +
上述错误发生在列表框的 SelectedIndexChanged 单击事件上。 debug返回的值是"",但是看网页源码肯定有值。 这是我的列表框: 这是事件: protected void ls
我的问题与此类似:How to prevent ListBox.SelectedIndexChanged event? , 但我想换个方式问。 是否有一种简单的方法来确定“SelectedIndexC
我是一名优秀的程序员,十分优秀!