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.


is a single character string a number as well?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-05-2007, 07:21 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default is a single character string a number as well?

Hi.

I want to know whether a single character string is also a number, e.g. can it be compared to a number, or is there an EVAL function to convert it to a number? I am getting FormatException errors.......

thnx

Marc
Reply With Quote
  #2 (permalink)  
Old 06-05-2007, 07:39 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 636
Default

Hi Stellaferox,

what are you trying to do?
If needed, basic4ppc uses automatically type conversion, so
Code:
a = "3"
b = 4
if a > b then
is possible.

Additionally you can convert a single char into ascii value with ASC("r") or an ascii code into its character Chr(58).

If you provide the code causing the exception we'll have a look at it!


specci48
Reply With Quote
  #3 (permalink)  
Old 06-06-2007, 06:51 AM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

Hi specci48,

thnx for your answer. the code is really long so I don't want to bother you with that. Do you know what the errorcode FormatException really means?
Marc
Reply With Quote
  #4 (permalink)  
Old 06-06-2007, 12:07 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,313
Default

Hi,

If you are sure of the variable beeing compatible, usually format exception error are caused by missing or , or ;...
__________________
Paulo Gomes
Porto, Portugal

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

DLL Version Listing
Reply With Quote
  #5 (permalink)  
Old 06-06-2007, 12:22 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I frequently experience the format exception error when I call up properties of controls with the wrong arguments, particularly when using the Control command to reference to a control.
You should be given a step number and from there it shouldn't be too difficult to determine what is wrong.

Can you just post the section of code that errors?

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #6 (permalink)  
Old 06-06-2007, 06:32 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

OK, guys, here is the code. It is a program for logistic regression taken (with permission from the author) at http://www.statpages.org/logistic.html (source code). Disregard the stringsigns ($). I know they are not necessary but I am translating from an older basic for PSION code which I made a few years ago.....
just run the program and it errors with a formatexception.
I assume the error in is this part:
IF ChkbxGrouped.Checked = TRUE then
'for zeros
d = SubString(v,0,StrIndexOf(v,",",0)) 'what is value left of comma for zeros
IF d > MaxX then MaxX = d 'set MaxX
IF d < MinX then MinX = d 'set MinX
Y0 (i) = d
sY0 = sY0+d
v = SubString(v,StrIndexOf(v,",",0)+1,1) 'reset dd$, right of comma
d = SubString(v,0,StrIndexOf(v,",",0)) 'what is value left of comma for zeros
'for ones
'what is value left for ones
Y1(i) = d
sY1 = sY1+d
ELSE
IF IsNumber(v) then
Select v
Case 0
Y0(i) = 1
sY0 = sY0+1
Case 1
Y1(i) = 1
sY1 = sY1+1
End Select
END IF
END IF
sC = sC+(Y0(i)+Y1(i))
END IF '// end check if string <> empty


thnx for the trouble......
Marc
Attached Files
File Type: sbp LogReg.sbp (24.6 KB, 13 views)
Reply With Quote
  #7 (permalink)  
Old 06-06-2007, 07:08 PM
dzt's Avatar
dzt dzt is offline
Basic4ppc Veteran
 
Join Date: May 2007
Location: Greece
Posts: 353
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Hi,

I took a quick look at your code.

You can,t make arithmetic operations without numbers.
xsd(j), xM(j), sC does not contain numbers (empty) when the first error occurs, at line 156.

Try to give them initial values and watch them as they change (MsgBox-ing them is a way, or put their values in a textbox)

Check all your source. I thing there are more errors like this one.

regards
__________________
Dimitris Zacharakis
http://www.terracom.gr
Reply With Quote
  #8 (permalink)  
Old 06-06-2007, 08:24 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

I recommend you to put breakpoints and in the lines that cause the problems.
Immediately you'll see that you are dividing by 0 in line 154 and line 155 (sC = 0).
Reply With Quote
  #9 (permalink)  
Old 06-06-2007, 08:40 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

They are initialized in the CreatePointer sub.
Reply With Quote
  #10 (permalink)  
Old 06-06-2007, 09:02 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Posts: 200
Default

I think the problem lies in

Par(0) = LN(sY1/sY0)

a few lines above that sY0 doesnt take the value I want and remains zero thus dividing by zero...
then I get an error in the line

vv = vv + Par(j) * X(i*(nR+1)+j)

saying "input string was not in correct format. I wonder why sY0 doesnt take values because that should be the case with the initial data.
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
Character encoding / code pages TWELVE Questions & Help Needed 10 05-29-2008 04:17 PM
ascii character problem Gale Johnson Questions & Help Needed 1 05-28-2008 04:59 PM
Pick up the single column single row value to a textbox. mozaharul Questions & Help Needed 4 05-07-2008 06:24 AM
How to convert Hex values in file to number or string HARRY Questions & Help Needed 2 02-20-2008 05:04 PM
possible to use a character to break off lines of code? Stellaferox Questions & Help Needed 2 02-11-2008 10:41 PM


All times are GMT. The time now is 12:10 PM.


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