alain bertrand Member Licensed User Longtime User Apr 27, 2019 #1 I wish a "Save" button checks if all the mandatory fields of a panel are not null before saving. Something like: Code: Copy 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 MsgBox... v.RequestFocus... Return (don't save) End If End If Next How to retrieve the v.Text of the v object for further use? Thanks for your help.
I wish a "Save" button checks if all the mandatory fields of a panel are not null before saving. Something like: Code: Copy 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 MsgBox... v.RequestFocus... Return (don't save) End If End If Next How to retrieve the v.Text of the v object for further use? Thanks for your help.
Marcus Araujo Member Licensed User Longtime User Apr 27, 2019 #2 V is type View. You need to cast it as EditText after checking if v is EditText. Then you can easily access its properties. Code: Copy Dim v2 as EditText = v If v2.Text.Trim.Length = 0 Then ... Upvote 0
V is type View. You need to cast it as EditText after checking if v is EditText. Then you can easily access its properties. Code: Copy Dim v2 as EditText = v If v2.Text.Trim.Length = 0 Then ...
Erel B4X founder Staff member Licensed User Longtime User Apr 28, 2019 #3 Check this: https://www.b4x.com/android/forum/t...gner-for-b4xpreferencesdialog.104670/#content Upvote 0
alain bertrand Member Licensed User Longtime User Apr 28, 2019 #4 OK. I'm back on track. Thanks to both of you! Upvote 0