in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

C1.C1Input.C1NumericEdit combined with other controls in a single control problem

Last post 05-06-2008 9:18 AM by C1_JohnAd. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-01-2008 5:21 AM

    • FDAGroup
    • Not Ranked
    • Joined on 03-04-2008
    • Istanbul
    • Posts 2

    C1.C1Input.C1NumericEdit combined with other controls in a single control problem

    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.
    Filed under:
  • 05-06-2008 9:18 AM In reply to

    Re: C1.C1Input.C1NumericEdit combined with other controls in a single control problem

    Hi,

    It seems that you have not set the FormatType property to CustomFormat, this
    property enables the custom formatting for C1NumericEdit.
    So, please set the CustomFomar property like the following.

    Me.C1NumericEdit1.FormatType = C1.Win.C1Input.FormatTypeEnum.CustomFormat

    Hope this helps.

    Regards,
    John Adams

    wrote in message news:204477@10.0.1.98...
    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.


    http://helpcentral.componentone.com/cs/forums/p/75125/204477.aspx#204477
Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.