get user directory of file in c#
C#
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
// TODO: Use LocalUser instead of Hardcode
openFileDialog.InitialDirectory = @"C:\Users\username\Desktop";
openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
//Get the path of specified file
filePath = openFileDialog.FileName;
//Read the contents of the file into a stream
var fileStream = openFileDialog.OpenFile();
using (StreamReader reader = new StreamReader(fileStream))
{
fileContent = reader.ReadToEnd();
}
}
}
Also in C#:
- Title
- c# implement a superclass in subclass
- Category
- C#
- Title
- unity how to change text in script
- Category
- C#
- Title
- input get button uibutton
- Category
- C#
- Title
- unity serializefield
- Category
- C#
- Title
- initialize matrix c#
- Category
- C#
- Title
- vb.net tostring numeric format string
- Category
- C#
- Title
- unity detect any key
- Category
- C#
- Title
- reference to gameobject in different scene unity
- Category
- C#
- Title
- unity change the source image or image
- Category
- C#
- Title
- razor preview
- Category
- C#
- Title
- non null array length
- Category
- C#
- Title
- c# region tag
- Category
- C#
- Title
- unity cast float to int
- Category
- C#
- Title
- how to find the type of a object c#
- Category
- C#
- Title
- roulette algorithm genetic algorithm
- Category
- C#
- Title
- c# getter setter
- Category
- C#
- Title
- how to change the title of the console in c#
- Category
- C#
- Title
- how to hide a panel ui unity
- Category
- C#
- Title
- c# input integer
- Category
- C#
- Title
- c# escape characters
- Category
- C#
- Title
- c# string array
- Category
- C#
- Title
- C# enum
- Category
- C#
- Title
- c# get current directory xamarin
- Category
- C#
- Title
- check if number is even or odd c#
- Category
- C#
- Title
- c# string to memorystream
- Category
- C#
- Title
- c sharp exit while loop
- Category
- C#
- Title
- open file in explorer c#
- Category
- C#
- Title
- iframe set html content c#
- Category
- C#
- Title
- unity quaternion
- Category
- C#
- Title
- c# window instantly close
- Category
- C#
- Title
- change textbox location C#
- Category
- C#
- Title
- asp.net core mvc not triggering client side validation
- Category
- C#
- Title
- how to change player cursor c# script unity
- Category
- C#
- Title
- csharp first element of array
- Category
- C#
- Title
- c# random number between 0 and 1
- Category
- C#
- Title
- choose random gameobject from a gameobject list
- Category
- C#
- Title
- how to store some variables on the device in unity
- Category
- C#
- Title
- 2D follow ia unity 2D with agrorange
- Category
- C#
- Title
- how to get array of children transform
- Category
- C#
- Title
- get day month year from date c#
- Category
- C#
- Title
- c sharp split string
- Category
- C#
- Title
- c# get all inherited classes of a class
- Category
- C#
- Title
- how to convert from hexadecimal to binary in c#
- Category
- C#
- Title
- unity how to change rotation
- Category
- C#
- Title
- c# quaternion eular calculator
- Category
- C#
- Title
- c# image to byte array
- Category
- C#
- Title
- how to add a list to observablecollection in c#
- Category
- C#
- Title
- how to spawn coins randomly around the screen unity 2d
- Category
- C#
- Title
- C# .net core convert int to enum
- Category
- C#
- Title
- unity make a int arry with preset values
- Category
- C#
- Title
- c# relaxed boolean cast
- Category
- C#
- Title
- set int to null c#
- Category
- C#
- Title
- httpcontext in .net standard
- Category
- C#
- Title
- ping with c#
- Category
- C#
- Title
- constructor in inherited class c#
- Category
- C#
- Title
- get type of variable c#
- Category
- C#
- Title
- unity get component
- Category
- C#
- Title
- load information with txt file to uwp c#
- Category
- C#
- Title
- unity get decimal part of float
- Category
- C#
- Title
- convert string array to int C#
- Category
- C#
- Title
- convert array object to int[] c#
- Category
- C#
- Title
- unity up arrow input
- Category
- C#
- Title
- where keyword in c#
- Category
- C#
- Title
- c sharp if string equals
- Category
- C#
- Title
- c# listview
- Category
- C#
- Title
- unity access child
- Category
- C#
- Title
- linq c# object except two lists
- Category
- C#
- Title
- fahrenheit to celsius c#
- Category
- C#
- Title
- call Textboxfor in cs
- Category
- C#
- Title
- how to deactivate objects through scripts in unity
- Category
- C#
- Title
- unity c# set gameobject active
- Category
- C#
- Title
- c# delay
- Category
- C#
- Title
- how to stop player rotating when hit by object
- Category
- C#
- Title
- max of array C#
- Category
- C#
- Title
- MVC creating a counter for products
- Category
- C#
- Title
- c# xml file builder
- Category
- C#
- Title
- c# type of generic is string
- Category
- C#
- Title
- c# download string url
- Category
- C#
- Title
- how to create a list in c# unity
- Category
- C#
- Title
- C# .NET Core linq Distinct
- Category
- C#
- Title
- Int64
- Category
- C#
- Title
- transform object according to its parent unity
- Category
- C#
- Title
- how to add an embedded resource in visual studio code
- Category
- C#
- Title
- c# function return
- Category
- C#
- Title
- c# serialize
- Category
- C#
- Title
- reverse a string in c#
- Category
- C#
- Title
- isprime c#
- Category
- C#
- Title
- c# object list attribute to string
- Category
- C#
- Title
- c# convert to nullable datetime
- Category
- C#
- Title
- how to route back to url using Request.Headers["Referer"].ToString() in asp.net core
- Category
- C#
- Title
- How do i destroy a prefab without the error?
- Category
- C#
- Title
- how to draw a dot in c#
- Category
- C#
- Title
- unity fps counter
- Category
- C#
- Title
- c# get country code
- Category
- C#
- Title
- covert char[] to string C#
- Category
- C#
- Title
- isInstanceOf nunit
- Category
- C#
- Title
- unity how to get data of play session time in a text file?
- Category
- C#
- Title
- How to search for a string from readline in c#
- Category
- C#
- Title
- c# tostring mmm dd yyyy
- Category
- C#
- Title
- or in unity
- Category
- C#