c# - Get Folder Path -
i want path of folder textbox , name of folder images12345. tried this.
//inside folder "images12345" string[] pics = { "1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg", "7.jpg", "8.jpg" }; int = 0;
then in form load
//i tried given me wrong path textbox1.text = path.getfullpath(@"images12345"); //then slideshow picturebox1.image = image.fromfile(textbox1.text+"/"+pics[0]); timer1.enabled = true; timer1.interval = 5000; = 0;
first, use application folder plus images folder:
string applicationpath = path.combine(appdomain.currentdomain.basedirectory, "images12345");
second, use path.combine
work paths:
picturebox1.image = image.fromfile(path.combine(myfolderpath, pics[0]));
note
you'll need copy images folder executable is. that's bin/degub
while you're debugging. can navigate 2 folders up, must implement like in production, when executable right next image folder.
edit
maybe it's better approach use current user's pictures folder. this:
string userpicturesfolderpath = environment.getfolderpath(environment.specialfolder.mypictures); string imagesfolder = path.combine(userpicturesfolderpath, "images12345");
Comments
Post a Comment