How can I avoid to use typeOf when I have some classes that inherit from a base class and I have to compare what type of class the variable is
in the following code:
If TypeOf MainView Is Dx.DxGridView Then
With CType(MainView, Dx.DxGridView)
.Columns(dc.ColumnName).DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
.Columns(dc.ColumnName).DisplayFormat.FormatString = "$ #,0.00"
End With
ElseIf TypeOf MainView Is Dx.DxCardView Then 'DevExpress.XtraGrid.Views.Grid.GridView Then
With CType(MainView, Dx.DxCardView)
.Columns(dc.ColumnName).DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
.Columns(dc.ColumnName).DisplayFormat.FormatString = "$ #,0.00"
End With
End If
to something like:
With CType(MainView, ThetypeOf(MainView))
.Columns(dc.ColumnName).DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
.Columns(dc.ColumnName).DisplayFormat.FormatString = "$ #,0.00"
End With
MainView is a generic Class (devExpress BaseView) and I want to set a column property, but the generic class don't have a "column" and I have to use a ctype, I like to use a ctype (or something else) on the same object to know his type
I say, if mainview is a "cardview" or "gridView" when I put ctype(mainview,somefunctionthatgivemethetype(mainview).column work
the same to use with ctype(businesslayerVariable,getmyowntype(businesslayerVariable)).someproperty and ctype(businesslayerVariable,getmyowntype(businesslayerVariable)) give me myBO type
it is posible? thanks!
sorry if I cannot write my question correctly, I speak in spanish and it's hard to me