Hi,
I have created a component in VS2005 using VB2005.I have included
C1NumericEdit control to it and attached some controls to format it.The thing
is no matter what I do I can't format the text /or value of C1NumericEdit.I
will attach the code written in VB.Net.Tell me what should I do.
Any help will make great use :)
'Code starts here
Public Class Miktar
'Class fields
Private m_Ondalik As Integer = 2
Private FormatString As String = ""
'Properties
Public Property FormatStr() As String
Get
Return
FormatString
End Get
Set(ByVal value As String)
FormatString
= value
End Set
End Property
Public Property Ondalik() As Integer 'This property
hold the number of digits that you want to be after decimal point
Set(ByVal value As Integer)
m_Ondalik =
value
SetFormat(m_Ondalik)
End Set
Get
Return
m_Ondalik
End Get
End Property
'Events
Private Sub Miktar_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
End Sub
'Methods
Private Sub SetFormat(ByVal intOndalik As Integer)
Dim frmt As String =
"###.###,"
If intOndalik > 0 Then
For i As
Integer = 1 To intOndalik
frmt = frmt.Insert(frmt.Length, "#")
Next
Else
frmt =
"###.###" 'Default format
End If
With m_txt
Me.FormatStr
= frmt
.CustomFormat = frmt
.EditFormat.CustomFormat = frmt
.DisplayFormat.CustomFormat = frmt
.ParseInfo.CustomFormat = frmt
.ParseInfo.NumberStyle = C1.Win.C1Input.NumberStyleFlags.Currency
.ParseInfo.FormatType = C1.Win.C1Input.FormatTypeEnum.StandardNumber
.ParseInfo.NumberStyle = C1.Win.C1Input.NumberStyleFlags.Currency
.Update()
End With
End Sub
Private Sub m_txt_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles m_txt.TextChanged
SetFormat(Me.Ondalik)
End Sub
End Class
'Code ends
Farshad D.A.