Retrieving a value from a column other than valuemember in Infragistics ultracomb

I am new to using infragistics controls (started yesterday). While they're (very) impressive, they add another layer of complexity that I'm confusing. So I'm asking a question, which I find to be a pretty simple problem:

I am trying to get the value from a column other than the one that is displayed in a combo box. So far all my attempts have only grabbed the value of the header column and not the value in the row column that was selected.

Specifically, I want to extract from my ultcombobox the value from the lastname column when the row is selected and put it in the textbox. In the code below, I am still fetching 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: "ucboPatientInfo.ValueMember =" accounts "" to help clarify what my code is actually doing is not really in that part of the code.

Please, help

+1


source to share


2 answers


the correct combination was found:



LastName = ucboPatientInfo.Cells(5).Value

      

0


source


It looks like you've found a working solution for your own problem. I thought I would just add more information and whatever needs to be considered.

You might want to avoid hard-binding the index to your cell if the position changes in the future when new data is added to the grid data source. Let's say you added another column before lastName, now your .Cells (5) will return incorrect data.

Try using cells ("columnName") for access instead, for example:

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

      



You should also try to use eventArgs and sender objects in your event and avoid direct control of refrence. So your code might look like this:

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

      

Glad to see your work anyway.

+4


source







All Articles