Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


How to achieve loop with textboxinput?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-06-2007, 03:18 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default How to achieve loop with textboxinput?

Hi,

I wonder how to achieve a loop with the textboxinput to achieve a number which lies between the acquired numbers.
I want to generate a loop like
DO UNTIL NM<Nr1 AND NM<Nr2 then
NM = textboxNM
LOOP
But this doesnt work. It generates an error. Any ideas?
thank in advance
Marc
Reply With Quote
  #2 (permalink)  
Old 05-06-2007, 03:21 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,134
Default

There should be no "then" in a Do Until / Do While loop:
In the next version, you will need to add .Text to get the TextBox text.
Code:
DO UNTIL NM<Nr1 AND NM<Nr2
NM = textboxNM.Text
LOOP
Reply With Quote
  #3 (permalink)  
Old 05-06-2007, 03:27 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

My fault. I didnt include the "then" but then it still didnt work. I await the next version then....
thnx
Marc
Reply With Quote
  #4 (permalink)  
Old 05-06-2007, 03:49 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,134
Default

The code above should work in this version without any problems.
What doesn't work for you?
Reply With Quote
  #5 (permalink)  
Old 05-06-2007, 04:15 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Well, the prgram doesn't seem to stop when values other then the wanted ones are put in. The reason the program has a parameter RunFirst = evident. The first time the program runs it takes the default values. The second time input is necessary in the sub Initparameters.
Attached Files
File Type: sbp Galton.sbp (6.6 KB, 10 views)
Reply With Quote
  #6 (permalink)  
Old 05-06-2007, 04:31 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,134
Default

I'm sorry but I didn't understand the problem.
What is the meaning of:
Code:
DO UNTIL NR<=MaxRows AND NR>=MinRows
 NR = txtbxRows.Text
LOOP

It will cause the program to hang if the values are not in the range.

Reply With Quote
  #7 (permalink)  
Old 05-06-2007, 05:41 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Yes, these three loops should take care of the problem that the input is in the wanted range. That was my question.
Now the program doesnt change the input and certainly not within the wanted boundaries. Or should the UNTIL keyword be after the LOOP word?
Reply With Quote
  #8 (permalink)  
Old 05-06-2007, 06:59 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

Why not use a simple If then else...?

If NR<=MaxRows AND NR>=MinRows then NR = txtbxRows.Text

If the AND bit doesn't work try

If NR<=MaxRows then
If NR>=MinRows then
NR = txtbxRows.Text
end if
end if
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #9 (permalink)  
Old 05-06-2007, 08:12 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Nope, doesn't work either. The program runs with the wrong parameters.
Reply With Quote
  #10 (permalink)  
Old 05-06-2007, 08:21 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,314
Default

Ok from what i understsnd you want to set an interval of values from wich the user must enter a number...Right?

I think that in that case you are testing the wrong variable....


You are testing NR before it is set to txtbxRow...

Try this...

If txtbxRows.Text<=MaxRows AND txtbxRows.Text>=MinRows then NR = txtbxRows.Text

Or more complete:

dim n as int16
n=txtbxRows.text
If n<=MaxRows AND n>=MinRows then NR = txtbxRows.Text
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Click event during a for loop pmu5757 Questions & Help Needed 7 04-12-2008 04:44 PM
Do...Loop While Put Claude Questions & Help Needed 1 07-24-2007 09:02 PM
How to achieve text edtion like in word? Cableguy Questions & Help Needed 3 07-03-2007 04:52 PM
Endless loop Cableguy Questions & Help Needed 8 06-28-2007 05:36 PM
error label and for next loop Cableguy Questions & Help Needed 4 05-23-2007 08:47 AM


All times are GMT. The time now is 05:07 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0