c# opening up Picture folder

Today is my first day at learning C#, or any programming language so sorry if I get some terms wrong

I have a way of doing this but not the way I'd like and want to know if there's a better solution. Aim is, on my C# program, when you click a button, it opens up the Picture folder.

I use the following code to do so:

private void picBox_Click(object sender, EventArgs e) {     Process.Start("explorer.exe", @"C:\Users\MYUSERNAME\Pictures"); } 

The code works however where MYUSERNAME is, that is fixed. What if I was to run the program on another machine account where the username is different. Is there a way to auto detect the name?

Replay

Category: c# Time: 2016-07-31 Views: 31
Tags:

Related post

  • How to have Finder open 'Pictures' folder when iPhone connects and photos import via AutoImporter.app? 2014-12-07

    I have a nifty setup on my MacBook Pro, where, upon connecting my iPhone, I have AutoImporter.app (/System/Library/Image Capture/Support/Application/AutoImporter.app) automatically import whatever photos are on my camera roll, delete them off the iPh

  • How to set clutter flow permanent for pictures folder on maverick 2010-10-12

    I would like to make the clutter flow on the Maverick permanent for the ~/pictures folder. when I close nautilus clutter flow resets and I have to again press F4 and resize the area. Which defeats the purpose of an eyecandy app IMO. Is there a way to

  • Publish/Synchronize 5GB Pictures Folder to Company Laptops 2010-11-30

    My users keep asking for the ability to have a local copy of our equipment pictures on their laptops. There is currently 5.2GB of data in that folder and it will continue to grow slowly over time. There is some chance that I will be able to reduce th

  • Recovering "My Pictures" folder on Windows using Ubuntu 2011-08-17

    My windows partition got infected with a virus so I can't boot in Windows. I am trying to recover some documents from the windows partition by booting Ubuntu on my dual boot system. I was successful in easily recovering some files from my desktop. Ho

  • How can I select a wallpaper that is not is the Pictures Folder? 2012-05-04

    I don't like to use the pre-made folders. I want to organize the things the way I want and with the names I want. Moreover I don't want to have to move a picture every time I want to try and see how it looks as a background wallpaper. So, how can I q

  • Why do the wallpapers I put in the 'Pictures folder' never save? 2012-07-02

    I was in the appearance settings and I added some of my own custom wallpapers. It was all good, until I went back later only to find that all of the images I have imported where gone. Every time I added them, they would disappear upon reopening of th

  • can I point my Pictures folder to a folder in an external hard drive? 2012-12-27

    I would like to save some space on my laptop and to do so I was thinking of moving my Pictures folder on an external hard drive. As OSX doesn't want me to mess around with the main folders in my home, how can I do this and is it safe to do so? (this

  • make new Finder windows open at current folder 2013-05-08

    In Windows when I browse in Explorer, if I open a new Explorer window, it is opened to the same location as the window I had selected when I hit Ctrl-N. Is there a way of doing the same with Finder? So if I'm browsed to Pictures, when I hit Command-N

  • Pictures folder on 1 TB external hardrive corrupted and became an extentionless unreadable file 2013-09-12

    My 1 TB external drive where I keep most of my photos has corrupted. My Pictures folder has become an extentionless file which cannot be opened. The other folders appear to be OK but I don't use them. Is there anyway to convert the extentionless file

  • Access back-up of Pictures folder on network drive 2015-05-30

    I backed up the contents of an old Macbook which was probably running 10.5.8 by copying ~/Pictures and ~/Documents to a network drive, right before the laptop died with the click-of-death, which probably indicates a failure of the hard-drive. Fortuna

  • How to make "Show in folder" open a special folder in Google Chrome 2016-07-09

    When I open file's dodwnload folder using the "Show in folder" button in Google Chrome, a Windows Explorer window is opened to absolute location of that folder. If I have used default settings for my download then "Show in folder" and

  • How to open the parent folder in a new window in Windows Vista or Windows 7? 2009-08-04

    In XP, control-click on the "up folder" icon opens the parent folder in a new Window. After much searching, I find no way to do this in Vista. It's easy to get to the parent folder, but not in a new window. --------------Solutions------------- Y

  • Windows shortcut to directly open a new folder in Windows Vista 2009-10-05

    Is there any key to directly open a new folder in the Windows Vista? Unlike XP, Vista does not have any quicklaunch button on the side of the window. --------------Solutions------------- While holding the Alt key, press in succession : F W F. ALT+ F

  • Windows Explorer hangs when opening a specific folder 2010-03-05

    When I open a particular folder on my inside a folder on my desktop. This folder was copied via a DVD-ROM from a previous computer. I didn't have any problems with this folder on the other computer. There are 36,316 files and 7,558 folders in this di

  • How can I keep the My Pictures folder synchronised with SmugMug? 2010-07-01

    How can I keep the My Pictures folder synchronised with my SmugMug account? Ideally, I would like new folders added to My Pictures to be automatically added, and edits automatically uploaded. However, I also want the possibility of deleting a folder

  • Picasa duplicates everything into a `$My Pictures` folder 2010-12-25

    My parents have a Windows XP laptop running Picasa, Dutch version of both. It's configured to put imported photos in C:\Documents and Settings\user\Mijn documenten\Mijn afbeeldingen, which is Windows XP's default My Pictures folder localized to Dutch

  • Ubuntu One won't synchronize pictures folder 2011-01-15

    When I try to sync /home/tyler/Pictures I get could not enable /home/tyler/Pictures for syncing to Ubuntu One --------------Solutions------------- If you try to create a synchronized folder from something that is not an actual directory inside your h

  • Super slow opening my downloads folder 2011-02-01

    I have an exe file in my download folder that I half downloaded through utorrent (it's not piracy, a legit file from people who use bittorrent to distribute large files). I think I tried to open it while it was still sharing, that is, did not stop th

  • How to have Vim launched and opening a specific folder at startup on MacOS? 2011-03-29

    Switching from TextMate to Vim, I'd like to have Vim launched and opening a specific folder at startup on MacOS? Manually I can start Vim from the shell with mvim someFolder. I use MacOS 10.6 and NERDTree. Thanks! EDIT: Reading and trying to apply th

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.347 (s). 13 q(s)