从 Infragistics ultracombo 中除了 valuemember 列之外的其他列获取值

发布于 2024-07-10 16:18:10 字数 695 浏览 7 评论 0原文

我对使用基础设施控制相当陌生(昨天开始)。 虽然它们(非常)令人印象深刻,但它们确实增加了另一层复杂性,而我正在努力解决这一问题。 所以我问的是一个我认为相当简单的问题:

我试图从组合框中显示的列之外的另一列中获取值。 到目前为止,我的所有尝试仅获取标题列的值,而不是所选行列中的值。

具体来说,我想在选择一行时从我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

止于盛夏 2024-07-17 16:18:10

看来您找到了解决自己问题的有效方法。 我想我应该添加一些更多的信息和需要考虑的事情。

您可能希望避免对单元格进行硬索引引用,以防将来在向网格数据源添加新数据时位置发生变化。 假设您在姓氏之前插入另一列,现在您的 .Cells(5) 将返回不正确的数据。

相反,请尝试使用 Cells("columnName") 进行访问,如下所示:

LastName = ucboPatientInfo.Cells("LastName").Value

您还应该尝试在事件中使用 eventArgs 和发送者对象,并避免直接控制引用。 所以你的代码可能看起来像这样:

LastName = e.Row.Cells("LastName").Value.ToString()

很高兴看到你在任何情况下都能解决问题。

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:

LastName = ucboPatientInfo.Cells("LastName").Value

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:

LastName = e.Row.Cells("LastName").Value.ToString()

Glad to see your workin things out in any case.

べ映画 2024-07-17 16:18:10

找到正确的组合:

LastName = ucboPatientInfo.Cells(5).Value

found correct combination:

LastName = ucboPatientInfo.Cells(5).Value
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文