c# - pictureBox.ImageLocation with asteriks -
i'm considerably new c# , visual studio got stuck on 1 problem. there way make picturebox propertie locate image file? asteriks doesn't seem work..
this.picturebox1.imagelocation = "d:\\*.png";
the directory alawys consists of single .png file, though changes name periodically.
you can't use wildcards on picturebox
, directory.getfiles support them. use so:
string[] files = directory.getfiles(@"d:\", "*.png"); if (files.length > 0) { // file(s) found. can either decide // 1 display or display first // 1 picturebox1.imagelocation = files[0]; } else { // no files found. display default image or }
Comments
Post a Comment