Home All Groups Group Topic Archive Search About

Default Path and Cursor files.

Author
16 Mar 2006 11:23 AM
JohnSouth
Hi

I've been setting the location of a cursor file like this:

this.Cursor= new Cursor("HandCur.cur");

I've just found out (the hard way) that if, elsewhere in the
application, the user browses for a file using the openFileDialog then
the default path is changed and the application looks for the cursor
file in the last openFile path, and run-time error.

I can solve it with hard-coded paths, but is there a better way of
avoiding this problem in general?

I'd appreciate suggestions.

John South
www.wherecanwego.com
Pangbourne UK

Author
16 Mar 2006 11:36 AM
scott blood
John,

You can use the following

this.Cursor = new Cursor(Application.StartupPath + "HandCur.cur")

Regards
Scott Blood
C# Developer

Show quoteHide quote
"JohnSouth" <JohnSouth***@gmail.com> wrote in message
news:1142508227.925376.182260@i39g2000cwa.googlegroups.com...
> Hi
>
> I've been setting the location of a cursor file like this:
>
> this.Cursor= new Cursor("HandCur.cur");
>
> I've just found out (the hard way) that if, elsewhere in the
> application, the user browses for a file using the openFileDialog then
> the default path is changed and the application looks for the cursor
> file in the last openFile path, and run-time error.
>
> I can solve it with hard-coded paths, but is there a better way of
> avoiding this problem in general?
>
> I'd appreciate suggestions.
>
> John South
> www.wherecanwego.com
> Pangbourne UK
>



Post Thread options