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.

Help With Code Please

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-19-2009, 06:22 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default Help With Code Please

I got a question.

I need a code that dose something like this that will work:

If TextBox1.Text 0 To 14 Then
Textbox2.Text = 1
Else If Textbox1.Text 15 To 29 Then
Textbox2.Text = 2
Else
Textbox2.Text = 3
End If

Last edited by cdeane : 01-19-2009 at 06:24 PM.
Reply With Quote
  #2 (permalink)  
Old 01-19-2009, 06:35 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

1st way:

If TextBox1.Text >0 and TextBox1.Text< 14 Then
Textbox2.Text = 1
Else If Textbox1.Text>15 and TextBox1.Text< 29 Then
Textbox2.Text = 2
Else
Textbox2.Text = 3
End If

2nd way:

Select TextBox1.text

case >0 and <14
TextBox2.text=1
case >15 and <29
TextBox2.Text=2
Case >= 30
TextBox2.text=3
End select
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #3 (permalink)  
Old 01-19-2009, 06:52 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

Thanks Cableguy
Reply With Quote
  #4 (permalink)  
Old 01-19-2009, 06:53 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

This code will not work:
Code:
Select TextBox1.text
case >0 and <14
TextBox2.text=
1
case >15 and <29
TextBox2.Text=
2
Case >= 30
TextBox2.text=
3
End select
Select Case doesn't support these operators.
Reply With Quote
  #5 (permalink)  
Old 01-19-2009, 07:07 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

The code should be:
Code:
If TextBox1.Text >= 0 and TextBox1.Text <= 14 Then
  Textbox2.Text = 
1
Else If Textbox1.Text >= 15 and TextBox1.Text <= 29 Then
  Textbox2.Text = 
2
Else
  Textbox2.Text = 
3
End If
Otherwise you will miss the values 14, 15 and 29

Best regards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #6 (permalink)  
Old 01-19-2009, 08:55 PM
Knows the basics
 
Join Date: Aug 2007
Location: Arkansas
Posts: 68
Default

Thanks Klaus

That did the trick.
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
help with code twisted Questions (Windows Mobile) 10 01-09-2009 06:27 PM
code just... stops! Offbeatmammal Questions (Windows Mobile) 4 06-02-2008 07:30 PM
Add Code giannimaione Questions (Windows Mobile) 5 06-01-2008 06:03 PM
Where is Form Code? enonod Questions (Windows Mobile) 2 10-13-2007 12:04 PM
Help with code cdeane Questions (Windows Mobile) 9 09-22-2007 04:30 PM


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


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