I have a WinGrid on a form which does not have any data bindings until the form is loaded at run time. on the Form1_Load event I am trying to add two unbound columns to the first band in the grid.
Dim UltraGridColumn6 As New Infragistics.Win.UltraWinGrid.UltraGridColumn("ucStart", 1)
With UltraGridColumn6
.AutoEdit = False
.CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly
.Header.Caption = "Overall Start"
.Header.VisiblePosition = 3
End With
Me.UltraGrid1.DisplayLayout.Bands(0).Columns.Add(UltraGridColumn6)
This ultragrid overrides the OnEnter event and tries to get the first visible, non-disabled ultra grid cell for determining the tab stop by using the VisiblePositionWithinBand property of the ColumnHeader object for each column.
Unfortunately, this property is not set to an instance of a reference by the time this code is hit?
Am I trying to add a column in the wrong way, or can I call a method so that this VisiblePositionWithinBand property is set?
The extra trouble that I am running into is that VisiblePositionWithinBand is read only and cannot be modified.
Any suggestions?
I would recommend using the InitializeLayout event to add your unbound column, rather than Form_Load - although this probably has nothing to do with your question.
As for VisiblePositionWithinBandnot being set, I'm not sure what you mean by that. I guess you are saying that it is not set to the right value in the Enter event of the grid, but I can't see how that could be the case, unless maybe it's because the grid hasn't painted, yet. If that's true, then you could try calling grid.Refresh first and see if that helps.
lblackburn said:The extra trouble that I am running into is that VisiblePositionWithinBand is read only and cannot be modified.
Set VisiblePosition.