Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 5th, 2006, 8:38 PM   #1
Keiran
Newbie
 
Join Date: May 2006
Location: uk
Posts: 3
Rep Power: 0 Keiran is on a distinguished road
Send a message via AIM to Keiran Send a message via MSN to Keiran
When using variables things dont work..

Been trying to figure out how to make it work for the last few hours, not sure what to search for on google, so i thought i'd ask here, and *hope* for an answer
If InStr(dmsg, prefix & "makedir") = 1 Then
Dim MakeDirectory As String
'MsgBox dat(4), vbOKOnly, "Testing.."
MakeDirectory = dat(4)
Call MkDir(MakeDirectory)
End If
The code works fine when MakeDirectory = "C:\Testing"
but if i change it to dat(4) which is part of an array, and in the MsgBox shows fine as "C:\Testing" it wont work..
dmsg, refers to the first word/command given to it on the irc server
and dat(4) refers to the second, like
example:
(+Keiran) .makedir C:\Testing
Hope ive explained it Ok !
Thanks
Keiran is offline   Reply With Quote
Old Jul 5th, 2006, 9:18 PM   #2
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
Well MkDir("C:\TestingThis") works fine for me... so my next guess it that the 4 element (i forgot how indexing works in vb) of your array dat is something different. Although your msgbox works maybe there is space or and odd character at the end throwing it off?

Does it bomb out...?

Does it produce an error?
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org
Kilo is offline   Reply With Quote
Old Jul 6th, 2006, 6:05 AM   #3
Keiran
Newbie
 
Join Date: May 2006
Location: uk
Posts: 3
Rep Power: 0 Keiran is on a distinguished road
Send a message via AIM to Keiran Send a message via MSN to Keiran
I changed the code to have error checking, and to remove any spaces from the variable to see if that was the problem

If InStr(dmsg, prefix & "makedir") = 1 Then
On Error GoTo mkdirerr
Dim Dir2Make As String
Dir2Make = Replace(dat(4), " ", "")
Call MkDir(Dir2Make)
wsCon.SendData SendMessage & "Operation Complete " & vbCrLf
mkdirerr:
wsCon.SendData SendMessage & "Operation Failed - " & Err.Description & vbCrLf
End If

This is the error i get
( 11:43:26 ) ( Keiran[away] ) .makedir C:\Testing
( 11:43:28 ) ( Administrator ) Operation Failed - Path not found
Keiran is offline   Reply With Quote
Old Jul 19th, 2006, 2:14 PM   #4
linxis
Programmer
 
Join Date: May 2006
Location: USA
Posts: 52
Rep Power: 0 linxis has a little shameless behaviour in the past
Send a message via ICQ to linxis
put the array declaration up
that may be the error

I havn't used VB in a while but isn't an array like this data[4] or is taht only c
__________________
Get programming and game creation tutorials and discuss apon you peers at
http://s14.invisionfree.com/tsoft
We also accept custom software requests and new mods will be needed soon
linxis is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC