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.

StrSplit oddity

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-20-2007, 04:18 PM
Junior Member
 
Join Date: Apr 2007
Location: Leicester, UK
Posts: 18
Default StrSplit oddity

Love StrSplit. Saves me some lines of code and is far more elegant. Having trouble though with the dim statement in Globals. If I use Dim words(0) as string it is fine in a standalone test prog but if I include it in my big and near completed prog I get:
Error compiling program.
Error description: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Occured on line: 5
Dim words(0) as string

If I use just Dim words(0) without the 'as string' reference then it is OK.

Are there any issues if I omit the 'as string'?
Reply With Quote
  #2 (permalink)  
Old 05-20-2007, 05:55 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

It is fine to omit the 'as string' here.
I don't see any reason why leaving the 'as string' will not work.
Can you post some of your code or send it to erel@basic4ppc.com?
Reply With Quote
  #3 (permalink)  
Old 05-20-2007, 07:25 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

The problem is here:
Dim words(0) as string
Dim string(0) as Byte, secret(0) as Byte, NewArray(0) as Byte

You are using a variable named string and it causes a confusion.
Anyway, just omit the 'as string' and it will work fine.
Reply With Quote
  #4 (permalink)  
Old 05-20-2007, 10:10 PM
Junior Member
 
Join Date: Apr 2007
Location: Leicester, UK
Posts: 18
Default

Many thanks Erel. And they were adjacent lines! I should have seen that. Thanks again.
J
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


All times are GMT. The time now is 09:37 AM.


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