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.

How do I use IF x.text="" OR y.text=""

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-19-2007, 05:44 PM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default How do I use IF x.text="" OR y.text=""

I have a form with lets say 2 textboxes; textbox x and textbox y

the thing is I want b4ppc to check if in one of them is text typed in (only ok when OR x OR y is typed in, not ok when x AND y are typed in or if nothing is typed in).
I thought i could use:
If x.text="" OR y.text="" Then
Msgbox("Please fill in x or y")
Return
End If
Thanks!
Jorrit
Reply With Quote
  #2 (permalink)  
Old 12-19-2007, 05:56 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

You probably want

If x.text="" AND y.text="" Then
Reply With Quote
  #3 (permalink)  
Old 12-19-2007, 07:11 PM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default

I would think you are right. It works better. The problem is bigger:
i have more then two lines which can be filled in:
x.text, y.text and z.text
If I use the AND argument
IF x.text="" AND y.text="" AND z.text="" my program will accept only when one is filled in (and that's what I want!), but also if i fill in all three (and that's what I don't want). My problem is therfore: how do I make my program that it will accept only and filled (x or y or z)?
Reply With Quote
  #4 (permalink)  
Old 12-19-2007, 07:59 PM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default

Maybe I can do something like add the text from x+y+z and compare that with ""?
I think that's they way, but I don't know how to compare them. I tried this but it's not working:

Can I make a new variable and then

compare=x.text+y.text+z.text
if compare ="" then
etc. etc.
Reply With Quote
  #5 (permalink)  
Old 12-19-2007, 09:00 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Hi sunnyboyj,

if the textboxes have similar names with different numbers like textbox1, textbox2, etc. you can cycle through the textboxes with the control statement.
I add a small example for this. Maybe it's a possible solution for you.


specci48
Attached Files
File Type: sbp TestMultipleInput.sbp (1.2 KB, 13 views)
Reply With Quote
  #6 (permalink)  
Old 12-20-2007, 05:24 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,732
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You could also use:
Code:
compare=x.text & y.text & z.text
if compare ="" then ...
& - Concatenation character.
Reply With Quote
  #7 (permalink)  
Old 12-20-2007, 06:06 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default groups

It will be very efficient for at least one program of mine if there is a way to group together several controls (mainly textboxes) and perform operations on all of them using one command, for example - change the color of all the textboxes in the group, or like in this thread - check if the text is null.

Of course, using the control method is possible but then I loose the textboxes specific names and programming becomes much more difficult then it is now...
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 12-20-2007 at 06:11 AM.
Reply With Quote
  #8 (permalink)  
Old 12-20-2007, 08:54 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Of course, using the control method is possible but then I loose the textboxes specific names and programming becomes much more difficult then it is now...
You could try putting the control names in an array and reference them as Control(Array(i)).Color
Reply With Quote
  #9 (permalink)  
Old 12-20-2007, 11:17 AM
Junior Member
 
Join Date: Dec 2007
Posts: 32
Default

thanks, great responses!
Reply With Quote
  #10 (permalink)  
Old 12-20-2007, 11:22 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Array

thanks Agraham, I like your solution

I implemented it on a group of 34 controls to change color and fontcolor - very efficient in saving code lines.

I had to use for -next loop with index, I did not succeed in

Control(boxes()).Color = 0,0,0 and got this error : "object does not contain a definition for ToLower "

is it my fault or the compiler's ?
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 12-20-2007 at 12:21 PM.
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
Text an einen bereits bestehenden Text "anhängen" JOTHA German Forum 7 09-12-2008 01:08 PM
"AddEvent" and "buttonUp/buttonDown" Byak@ Questions (Windows Mobile) 12 09-10-2008 03:04 PM
Is there any thing like Visual Basic "Tabbed dialog control" in Basic4ppc? mozaharul Questions (Windows Mobile) 6 03-23-2008 11:07 AM
Image Button kommt nicht wieder "hoch" troll German Forum 3 02-22-2008 09:03 AM
calling the device's "Programs" or "settings" screens HarleyM Questions (Windows Mobile) 0 12-05-2007 02:59 AM


All times are GMT. The time now is 06:15 AM.


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