从 Infragistics ultracombo 中除了 valuemember 列之外的其他列获取值
我对使用基础设施控制相当陌生(昨天开始)。 虽然它们(非常)令人印象深刻,但它们确实增加了另一层复杂性,而我正在努力解决这一问题。 所以我问的是一个我认为相当简单的问题:
我试图从组合框中显示的列之外的另一列中获取值。 到目前为止,我的所有尝试仅获取标题列的值,而不是所选行列中的值。
具体来说,我想在选择一行时从我的 ultracombobox 中获取姓氏列的值并将其放置在文本框中。 到目前为止,我的下面的代码会重新运行标题列(LastName),无论我选择哪一行,都不会执行其他任何操作。
Private Sub ucboPatientInfo_RowSelected(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.RowSelectedEventArgs) Handles ucboPatientInfo.RowSelected
ucboPatientInfo.ValueMember = "accounts"
LastName = ucboPatientInfo.SelectedRow.Band.Columns(1).ToString
我添加了:“ucboPatientInfo.ValueMember = 'accounts'”来帮助澄清我的代码正在做什么,它实际上并不在代码的这一部分中。
请帮忙
I am fairly new to using infragistics controls (started yesterday). While they are (very) impressive they do add another layer of complexity, which I am muddeling through. So I am asking what I feel to be a fairly simple issue:
I am trying to get the value from another column besides the one that is displayed in the combobox. So far all my attempts have only grabbed the value of the header column not the value in the row column that was selected.
Specifically I want to take from my ultracombobox the value from the lastname column when a row is selected and place it in a textbox.
The below code I have so far retruns the header column (LastName) and nothing else no matter which row I select.
Private Sub ucboPatientInfo_RowSelected(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.RowSelectedEventArgs) Handles ucboPatientInfo.RowSelected
ucboPatientInfo.ValueMember = "accounts"
LastName = ucboPatientInfo.SelectedRow.Band.Columns(1).ToString
I added the: "ucboPatientInfo.ValueMember = 'accounts'" to help clarify what my code is doing it is not actually in this part of the code.
Please help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您找到了解决自己问题的有效方法。 我想我应该添加一些更多的信息和需要考虑的事情。
您可能希望避免对单元格进行硬索引引用,以防将来在向网格数据源添加新数据时位置发生变化。 假设您在姓氏之前插入另一列,现在您的 .Cells(5) 将返回不正确的数据。
相反,请尝试使用 Cells("columnName") 进行访问,如下所示:
您还应该尝试在事件中使用 eventArgs 和发送者对象,并避免直接控制引用。 所以你的代码可能看起来像这样:
很高兴看到你在任何情况下都能解决问题。
Looks like you found a working solution to your own problem. I thought I would just add in some more information and things to consider.
You may want to avoid a hard index refrence to your cell, in case the position changes in the future as you add new data to the grid's datasource. Say you insert another column ahead of lastName, now your .Cells(5) will return incorrect data.
Instead try using the Cells("columnName") for access like this:
You should also try to use the eventArgs and sender objects within your event and avoid a direct control refrence. So your code could look like this instead:
Glad to see your workin things out in any case.
找到正确的组合:
found correct combination: