Skip to Content
author's profile photo Former Member
Former Member

want validation coding for numerical and alphapetical

friends,

plz i want to validate number and alphapetical in my own form.can u give me a coding for that

Edited by: Rui Pereira on Dec 23, 2008 3:41 PM

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Nov 17, 2008 at 08:47 AM

    perinba,

    Here is an example, to check when add or update A BP

    1.check the cardcode format: length should be 5, staring with "C" or "V"

    2.check the balance of the bp

    If it is your own form, you may use UserDatasource instead of String..

    Sub ItemEventHandler(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, _
           ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
    If "134" = pVal.FormType _
               And pVal.ItemUID = "1" _
               And (pVal.FormMode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Or pVal.FormMode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE) Then
                Dim oForm As SAPbouiCOM.Form = oApp.Forms.Item(pVal.FormUID)
                Dim oCardCodeEdit As SAPbouiCOM.EditText = oForm.Items().Item("4").Specific
                Dim cardCode As String = oCardCodeEdit.Value
                'check the cardcode format: length should be 5, staring with "C" or "V"
                If cardCode.Length <> 5 Or (cardCode.StartsWith("C") = False And cardCode.StartsWith("V") = False) Then
                    oApp.MessageBox("Invalid CardCode.")
                    'Stop it
                    BubbleEvent = False
                End If
    
                Dim oBalanceEdit As SAPbouiCOM.EditText = oForm.Items.Item("26").Specific
                Dim balanceStr As String = oBalanceEdit.Value
                'check the balance of the bp
                If CInt(balanceStr) < 0 Then
                    oApp.MessageBox("Negative balance")
                    'Stop it
                    BubbleEvent = False
                End If
            End If
    End Sub

    Kind Regards

    -Yatsea

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 18, 2008 at 06:20 AM

    yetsie,

    first thank you for ur help. but i dont know where i am going to use this coding. i am giving my validation coding in itemevent. plz tell me where should i use this coding. my question is i have one form. its having two edittext box. inthat when i enter value in that specific edittext and press add or ok button its show error messege if i am not giving numerical values or alphatical value and also when i am using specific length checking.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.