edit mask for numeric


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: edit mask for numeric

  1. #1
    hammam Guest

    edit mask for numeric


    hi
    any one can tell me how i can make edit mask for field 5,3
    i put #####.### in mask but it need to fill the first 5 first places then
    write the decimal part i want write for example 2 digit the press decimal
    point then the reset of blank to decimal point truncat and write the decimal
    part

    thanks

  2. #2
    Rick Rothstein Guest

    Re: edit mask for numeric

    Try this KeyPress event code for the MaskEdBox:

    Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
    Dim TempText As String
    Dim MaskDecPt As Long
    With MaskEdBox1
    MaskDecPt = InStr(MaskEdBox1.Mask, ".")
    If KeyAscii = Asc(".") And .FormattedText Like "* .*" Then
    TempText = .Text
    Mid$(TempText, 1, MaskDecPt) = String$(MaskDecPt - _
    Len(.ClipText) - 1, .PromptChar) & .ClipText
    .Text = TempText
    .SelStart = MaskDecPt
    End If
    End With
    End Sub

    Is that what you were looking for? (I wasn't 100% sure of what your question
    was.)

    Rick


    "hammam" <mhdhamam@hotmail.com> wrote in message
    news:390a632f$1@news.devx.com...
    >
    > hi
    > any one can tell me how i can make edit mask for field 5,3
    > i put #####.### in mask but it need to fill the first 5 first places then
    > write the decimal part i want write for example 2 digit the press decimal
    > point then the reset of blank to decimal point truncat and write the

    decimal
    > part
    >
    > thanks




  3. #3
    hammam Guest

    Re: edit mask for numeric


    thanks rick
    your subroutine worked correctlly 100%
    would u please tell me how i can display this no into maskedit
    no like 12.55 take care the mask for this field is #####.###
    thanks

    "Rick Rothstein" <rick_newsgroup@email.com> wrote:
    >Try this KeyPress event code for the MaskEdBox:
    >
    >Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
    > Dim TempText As String
    > Dim MaskDecPt As Long
    > With MaskEdBox1
    > MaskDecPt = InStr(MaskEdBox1.Mask, ".")
    > If KeyAscii = Asc(".") And .FormattedText Like "* .*" Then
    > TempText = .Text
    > Mid$(TempText, 1, MaskDecPt) = String$(MaskDecPt - _
    > Len(.ClipText) - 1, .PromptChar) & .ClipText
    > .Text = TempText
    > .SelStart = MaskDecPt
    > End If
    > End With
    >End Sub
    >
    >Is that what you were looking for? (I wasn't 100% sure of what your question
    >was.)
    >
    >Rick
    >
    >
    >"hammam" <mhdhamam@hotmail.com> wrote in message
    >news:390a632f$1@news.devx.com...
    >>
    >> hi
    >> any one can tell me how i can make edit mask for field 5,3
    >> i put #####.### in mask but it need to fill the first 5 first places then
    >> write the decimal part i want write for example 2 digit the press decimal
    >> point then the reset of blank to decimal point truncat and write the

    >decimal
    >> part
    >>
    >> thanks

    >
    >



  4. #4
    Rick Rothstein Guest

    Re: edit mask for numeric

    Are you asking how to use the number 12.55 that a user typed into the
    MaskEdBox? If so, you would get it from the FormattedText property (Trim it
    to remove the leading and trailing blank spaces). If you are asking
    something different, you will have to phrase your question differently.

    Rick

    "hammam" <mhdhamam@hotmail.com> wrote in message
    news:390b0966$1@news.devx.com...
    >
    > thanks rick
    > your subroutine worked correctlly 100%
    > would u please tell me how i can display this no into maskedit
    > no like 12.55 take care the mask for this field is #####.###
    > thanks
    >
    > "Rick Rothstein" <rick_newsgroup@email.com> wrote:
    > >Try this KeyPress event code for the MaskEdBox:
    > >
    > >Private Sub MaskEdBox1_KeyPress(KeyAscii As Integer)
    > > Dim TempText As String
    > > Dim MaskDecPt As Long
    > > With MaskEdBox1
    > > MaskDecPt = InStr(MaskEdBox1.Mask, ".")
    > > If KeyAscii = Asc(".") And .FormattedText Like "* .*" Then
    > > TempText = .Text
    > > Mid$(TempText, 1, MaskDecPt) = String$(MaskDecPt - _
    > > Len(.ClipText) - 1, .PromptChar) & .ClipText
    > > .Text = TempText
    > > .SelStart = MaskDecPt
    > > End If
    > > End With
    > >End Sub
    > >
    > >Is that what you were looking for? (I wasn't 100% sure of what your

    question
    > >was.)
    > >
    > >Rick
    > >
    > >
    > >"hammam" <mhdhamam@hotmail.com> wrote in message
    > >news:390a632f$1@news.devx.com...
    > >>
    > >> hi
    > >> any one can tell me how i can make edit mask for field 5,3
    > >> i put #####.### in mask but it need to fill the first 5 first places

    then
    > >> write the decimal part i want write for example 2 digit the press

    decimal
    > >> point then the reset of blank to decimal point truncat and write the

    > >decimal
    > >> part
    > >>
    > >> thanks

    > >
    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center