G
Guest
i'm trying to convert some code from VB to C#, i know i can use both in .net,
but we know C# better and want to be able to change some things around for
our own needs. i have all of it converted except for the "public event..."
of the following code. is there anyone that can help me convert this to C#
please?
thank you in advance,
Public Class ColumnInformation
Private m_Field As String
Private m_Width As Single
Private m_HeaderText As String
Private m_HeaderFont As Font
Private m_DetailFont As Font
Private m_Alignment As StringAlignment
Public Event FormatColumn(ByVal sender As Object, ByRef e As
FormatColumnEventArgs)
Public Function GetString(ByVal Value As Object)
Dim e As New FormatColumnEventArgs()
e.OriginalValue = Value
If Not IsDBNull(Value) Then
e.StringValue = CStr(Value)
Else
e.StringValue = "<NULL>"
End If
RaiseEvent FormatColumn(CObj(Me), e)
Return e.StringValue
End Function
Public Sub New(ByVal Field As String, _
ByVal Width As Single, _
ByVal Alignment As StringAlignment)
m_Field = Field
m_Width = Width
m_Alignment = Alignment
End Sub
Public Property Field() As String
Get
Return m_Field
End Get
Set(ByVal Value As String)
m_Field = Value
End Set
End Property
Public Property Width() As Single
Get
Return m_Width
End Get
Set(ByVal Value As Single)
m_Width = Value
End Set
End Property
Public Property Alignment() As StringAlignment
Get
Return m_Alignment
End Get
Set(ByVal Value As StringAlignment)
m_Alignment = Value
End Set
End Property
Public Property HeaderFont() As Font
Get
Return m_HeaderFont
End Get
Set(ByVal Value As Font)
m_HeaderFont = Value
End Set
End Property
Public Property HeaderText() As String
Get
Return m_HeaderText
End Get
Set(ByVal Value As String)
m_HeaderText = Value
End Set
End Property
Public Property DetailFont() As Font
Get
Return m_DetailFont
End Get
Set(ByVal Value As Font)
m_DetailFont = Value
End Set
End Property
End Class
but we know C# better and want to be able to change some things around for
our own needs. i have all of it converted except for the "public event..."
of the following code. is there anyone that can help me convert this to C#
please?
thank you in advance,
Public Class ColumnInformation
Private m_Field As String
Private m_Width As Single
Private m_HeaderText As String
Private m_HeaderFont As Font
Private m_DetailFont As Font
Private m_Alignment As StringAlignment
Public Event FormatColumn(ByVal sender As Object, ByRef e As
FormatColumnEventArgs)
Public Function GetString(ByVal Value As Object)
Dim e As New FormatColumnEventArgs()
e.OriginalValue = Value
If Not IsDBNull(Value) Then
e.StringValue = CStr(Value)
Else
e.StringValue = "<NULL>"
End If
RaiseEvent FormatColumn(CObj(Me), e)
Return e.StringValue
End Function
Public Sub New(ByVal Field As String, _
ByVal Width As Single, _
ByVal Alignment As StringAlignment)
m_Field = Field
m_Width = Width
m_Alignment = Alignment
End Sub
Public Property Field() As String
Get
Return m_Field
End Get
Set(ByVal Value As String)
m_Field = Value
End Set
End Property
Public Property Width() As Single
Get
Return m_Width
End Get
Set(ByVal Value As Single)
m_Width = Value
End Set
End Property
Public Property Alignment() As StringAlignment
Get
Return m_Alignment
End Get
Set(ByVal Value As StringAlignment)
m_Alignment = Value
End Set
End Property
Public Property HeaderFont() As Font
Get
Return m_HeaderFont
End Get
Set(ByVal Value As Font)
m_HeaderFont = Value
End Set
End Property
Public Property HeaderText() As String
Get
Return m_HeaderText
End Get
Set(ByVal Value As String)
m_HeaderText = Value
End Set
End Property
Public Property DetailFont() As Font
Get
Return m_DetailFont
End Get
Set(ByVal Value As Font)
m_DetailFont = Value
End Set
End Property
End Class