1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question How to check if all EditText of a panel are filled?

Discussion in 'Android Questions' started by alain bertrand, Apr 27, 2019.

  1. alain bertrand

    alain bertrand Member Licensed User

    I wish a "Save" button checks if all the mandatory fields of a panel are not null before saving.
    Something like:
    For Each v As View in pnlPanel1.GetAllViewsRecursive 'iterate panel's views
        If v Is EditText Then
    If v.Text.Trim.Lenght=0 Then ' <-- Here
    Return (don't save)
            End If
    End If
    How to retrieve the v.Text of the v object for further use?
    Thanks for your help.
  2. Marcus Araujo

    Marcus Araujo Member Licensed User

    V is type View. You need to cast it as EditText after checking if v is EditText. Then you can easily access its properties.

    Dim v2 as EditText = v
    If v2.Text.Trim.Length = 0 Then
    mangojack and José J. Aguilar like this.
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. alain bertrand

    alain bertrand Member Licensed User

    OK. I'm back on track.
    Thanks to both of you!
    Marcus Araujo likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice