Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

really weird issue with xp and vb.net

Status
Not open for further replies.

hayt

IS-IT--Management
Oct 5, 2004
132
US
I have a program that uses a string array, and executes a process based on the values in the array. There is a line of code that is:
if strArg(0).toUpper = "COPY" then
'do stuff
else
'do different stuff
end if

This works great in win2k environment, but in XP it will not execute the first statement ('Do Stuff)!!! I have tired it on 4 XP machines and 3 2k machines. the 2k machines execute fine, the xp doesn't. It will execute in the debug mode without a problem, but when i actually compile and run it, it does not pass that test. Anyone have ANY ideas as to why?


(NOTE - I also tried strArg(0).ToString.ToUpper = "COPY" just in case it switched to unicode or something, and that didn't help)
 
Code:
        Dim a() As String
        [COLOR=red]' ***[/color]
        a(0) = "copy"

        If a(0).ToUpper = "COPY" Then
            MsgBox("ok")
        Else
            MsgBox("no")
        End If

This code has occurs an error unless I input
Code:
reDim a(number)
where the "***" are.

It works fine in winXP
 
I have a message box that executes before the if statement, and one inside the if statement. the else messagebox executes, the if does not (does in debug mode).

The actual statement that does not execute is this:
FileCopy( strArg(1), strArg(2))

The way i instatiate my string array is this:

public sub main(byval strArg() as string)

I did this since the size of the array will be dynamic based on the arguments.

I never had any problem needing to redim in 2000, why would xp need it?

Also, when i say that it executes in debug, i put the argument in the configuration properties, debugging section of the project properties.
 
Is this a console application?
If yes, then tell me what program u are tring to make in case a can help u.

As i see, It will have 3 args
1: copy and move i guess?
2: source folder/or single file
3: destination folder


well ??
 
this program is actually used with a setup project. I have to run other executables from network shares, and don't want to include their assemblies in my setup build. So i created an executable project("exec") in which i send the executable path, and any arguments that sepecific executable needs. This "exec" app then executes the first argument (the shared executable) in a seperate thread.
As this project grew, I found myself needing greater functionality from the "exec" app. One thing i needed was the ability to copy a shortcut (.lnk) file to the target desktop. When i inculded this file in my original setup app, it actually grabbed the assembly from the app that the shortcut pointed to. So i decided to use my "exec" app to copy the lnk file to the desktop manually. It worked great in 2000, like i said, but now it's giving me problems.

phew...that was a lot to type, and i have no idea if that made any sense to anyone.
 
Ok.....i have it figured out. There is a flag in the string arguments for target machine locations (|Desktop|=System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop), etc.) and these flags are not being converted in xp....no idea why. but i hardcoded the flag changes, and it works fine.

Thanks to everyone for replying. I am sure that I will have more issues in the future.

hayt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top