Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
Unable to Get first column Name in the Grid, using (Bands[0].Columns[0]) retrieves the second column name in the grid.
posted

Hi,

I am using UFT 12.01 (.NET Add-In/Web Add-In) and Infragistics 2010 v.1

I am trying to get the columns names of a Win.UltraWinGrid.UltraGrid, and I am able to get them using:

Set ObjGrid = Obj_WdwN.SwfTable("swfname:=ultraGridMantoMemoAlarma")
ObjGrid.Highlight
a = ObjGrid.Object.DisplayLayout.Bands.item(0).Columns.item(0).Key

or even when using

a = ObjGrid.GetNAProperty("DisplayLayout.Bands[0].Columns[0].Header.Caption")

but the thing is that when doing this (Bands[0].Columns[0].) it shows up the column name of the second column in the grid, I am not able to get the first column Key(Name)

Could you please let me know If I am misisng something in the code...or this is an application issue that it is not taking the first column into the grid...or so....

Thanks, I will appreciate your response.

Parents
  • 48586
    Verified Answer
    posted

    Hello ,

     

    Indexing of column collection is based on the order on which columns were added to the collection. Position of the column in UltraGrid is based on VisibleIndex property of column object, in common case VisibleIndex is the same as column index, but it is wrong to assume that this is so in every case. So in your case it seems that your columns were reordered and VisibleIndex is not the same as Column Index, so you should get your column by key instead by index:

     

    a = ObjGrid.GetNAProperty("DisplayLayout.Bands[0].Columns[columnKey].Header.Caption")

     

    I hope that this will helps you.

Reply Children