Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Validating and Clearing Forms

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-24-2009, 12:43 AM
Newbie
 
Join Date: Oct 2009
Posts: 2
Post Validating and Clearing Forms

Hello, im new to Basic4ppc and have two questions.

1. Is there a way to clear all my form fields at one go?

2. Can i check/validate if any of the form fields(text) is left empty at one go?

the code snippet would help

Thx,
Bakshi

Last edited by ashmoloy : 10-24-2009 at 12:59 AM.
Reply With Quote
  #2 (permalink)  
Old 10-24-2009, 03:15 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Here:
Code:
Sub Globals
    
Dim controls(0)
    
End Sub

Sub App_Start
    Form1.Show
    
Msgbox(IsEmpty)
    ClearAllTextboxes
    
Msgbox(IsEmpty)
End Sub

Sub ClearAllTextboxes
    controls() = GetControls(
"form1")
    
For i = 0 To ArrayLen(controls()) - 1
        
If ControlType(controls(i)) = "TextBox" Then 'note that the control type is case sensitive.
            Control(controls(i), Textbox).Text = ""
        
End If
    
Next
End Sub

Sub IsEmpty
    controls() = GetControls(
"form1")
    
For i = 0 To ArrayLen(controls()) - 1
        
If ControlType(controls(i)) = "TextBox" Then
            
If Control(controls(i), Textbox).Text <> "" Then Return False
        
End If
    
Next
    
Return True
End Sub
__________________
Basic4android documentation
Reply With Quote
  #3 (permalink)  
Old 10-24-2009, 03:29 AM
Newbie
 
Join Date: Oct 2009
Posts: 2
Default

thx a ton...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Will clearing an array free the memory allocated? moster67 Questions (Windows Mobile) 2 03-08-2009 11:14 AM
Clearing a combobox's text area in code Ricky D Questions (Windows Mobile) 6 10-02-2008 10:31 AM
Cut and Paste & Clearing a table bish0p Questions (Windows Mobile) 7 09-02-2008 01:55 PM
Clearing combo box value mozaharul Questions (Windows Mobile) 1 03-18-2008 09:10 AM
Merging forms skipper Questions (Windows Mobile) 2 01-10-2008 01:18 PM


All times are GMT. The time now is 03:23 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0