Reference Columns by name also in the ListView.RowPopulating


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
It would be really helpful and safer to be able to reference a column by its name instead of the index in the ListView.RowPopulating event.



Ex Current code:



Private Sub VendorsBrowseDialog_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles MyBase.RowPopulating

'-- Strong type the passed business object

With CType(e.BusinessObject, CardTrackingSystem.Business.bizVendor)

e.UseGroup = True

e.GroupHeaderText = MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue(.VendorType)



'-- Show the Inactive Status with a red color

If .IsInactive Then

e.RowForeColor = Drawing.Color.Red

e.Values(4).DisplayValue = "Yes"

Else

e.Values(4).DisplayValue = String.Empty

End If

End With

End Sub







Ex Suggested code:



Private Sub VendorsBrowseDialog_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles MyBase.RowPopulating

'-- Strong type the passed business object

With CType(e.BusinessObject, CardTrackingSystem.Business.bizVendor)

e.UseGroup = True

e.GroupHeaderText = MicroFour.StrataFrame.Tools.Common.GetEnumDisplayValue(.VendorType)



'-- Show the Inactive Status with a red color

If .IsInactive Then

e.RowForeColor = Drawing.Color.Red

e.Values("VendorIsInactive").DisplayValue = "Yes"

Else

e.Values("VendorIsInactive").DisplayValue = String.Empty

End If

End With

End Sub



Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search