views:

935

answers:

2

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

A: 

found correct combination:

LastName = ucboPatientInfo.Cells(5).Value
Sean
+5  A: 

Hey Sean,

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.

Tj Kellie