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.


maybe a stupid question,but...


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-2007, 04:26 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 maybe a stupid question,but...

Hi,

Maybe is because I haven't been using b4ppc for the past 2 weeks or so but, how do I reference a string variable in this case?

file1="myfile.txt"
file2="second.png"
file.........
file20="lastfile.doc"
for x = 1 to 20
if file exist(???)=false then message the user......
Next x

How do I reference the file & x in this case?

I've tryed If fileexist(file & x) but it doesn't compute....
__________________
Paulo Gomes
Porto, Portugal

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

DLL Version Listing
Reply With Quote
  #2 (permalink)  
Old 06-15-2007, 04:46 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 I've got it to work..using an array, as I problably should have done to start of..But at the end of the for next loop i keep getting a " out of boudaries" error...

Here's the entire code...

Code:
Sub Globals
dim file(6)
End Sub

Sub App_Start
	Main.Show
	CheckFiles
	SIP(False)
End Sub

Sub CheckFiles
File(0)="Pairs v2.ini"
File(1)="1.png"
File(2)="2.png"
File(3)="3.png"
File(4)="4.png"
File(5)="5.png"
For x = 0 to arraylen(File())
	If FileExist(File(x))= true Then
		MsgBox(File(x))
	else
		Msgbox(file(x) & " is missing")
	end if
Next x 
End sub

EDIT:

I found my error...forgot to ad the "-1" in the "for x = 0 to arraylen(file())" line...

As i said, This could and was a "stupid" question....

BTW: I plan to use these subs to check the integrety of my app, so that if some file is missing, the app will not run at all...Not a piracy protection but more of a "error free" thing...I also plan to generate a log if the app does not start to list the missing file... this way will be easyer to debug.
__________________
Paulo Gomes
Porto, Portugal

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

DLL Version Listing

Last edited by Cableguy : 06-15-2007 at 04:55 PM.
Reply With Quote
  #3 (permalink)  
Old 06-15-2007, 04:54 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 638
Default

Hi Cableguy,

the length of the file array is 6 because there are 6 entries.
To access all of them your loop should go form zero to 5

Code:
For x = 0 to arraylen(File()) - 1

specci48


Sorry but I just missed your own correction...
Reply With Quote
  #4 (permalink)  
Old 06-15-2007, 06:45 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
I've tryed If fileexist(file & x) but it doesn't compute....
Sorry mate but I wasn't around earlier other wise I would have said that you probably needed to enclose the word file with quotation marks.

If fileexist("file" & x)

But I see that you and Specci48 have sorted it now

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
  #5 (permalink)  
Old 06-17-2007, 06:26 PM
Senior Member
 
Join Date: May 2007
Posts: 130
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Guys! since I'm still learning...can we use imagelist.Item(i)="1.jpg" ?
Reply With Quote
  #6 (permalink)  
Old 06-17-2007, 06:35 PM
Senior Member
 
Join Date: May 2007
Posts: 130
Awards Showcase
Beta Tester 
Total Awards: 1
Default

sorry guys, i'm off topic here, this is can only be use for images...
Reply With Quote
  #7 (permalink)  
Old 06-17-2007, 08:31 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
can we use imagelist.Item(i)="1.jpg"
You can indeed use the above statement.

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
  #8 (permalink)  
Old 06-17-2007, 11:44 PM
Peter's Avatar
Junior Member
 
Join Date: May 2007
Location: The Netherlands
Posts: 18
Default

There are no stupid questions, CableGuy, only stupid persons (who fail to ask questions)
__________________
PC : P4 3gHz, 512 MiB
PPC : Asus A600 + 1 GiB SD
---------------------------------------------------
(Reminder to self: )
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
Stupid question: Where is TreeView.dll? yildi Questions & Help Needed 2 02-16-2008 04:19 PM
One of my stupid questions.... Cableguy Questions & Help Needed 7 01-27-2008 11:26 AM
Another "Stupid" question!!! Cableguy Questions & Help Needed 2 06-28-2007 05:15 PM


All times are GMT. The time now is 03:55 PM.


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