-2

Possible Duplicate:
How to create and use resources in .NET

I use this code but if I run it from another place it obviously will be a wrong path.

string strPath = @"C:\Users\perdanny\Documents\Visual Studio 2010\Projects\PokerBlitz\PokerBlitz\Resources\Cards\" 
    + (suit * 13 + rank).ToString() + ".png";
Community
  • 1
  • 1

2 Answers2

1

If you haven't already added the file to the resources of the project you can do this by clicking on project -> add existing item. Then find the file in your file system. You can reference the file by using

Properties.Resources.fileName
Craig Smith
  • 583
  • 3
  • 9
  • 26
0

you could use something like this:

Application.StartupPath + (suit*13+rank).ToString() +".png";

probably you need to add some more directorys like \PokerBlitz\Resources\Cards\ I'm not sure about that.

You can read more on this topic here

2pietjuh2
  • 879
  • 2
  • 13
  • 29