How to open .pas file in c#? [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I want to open a free pascal or turbo pascal file that has a .pas extension from a wpf application.

If you want to open the editor associated with a file, then just do:
System.Diagnostics.Process.Start(path);
Where path is the FQN of the .pas file.
Basically, Windows will look for a program that is registered to view/edit the type (extension) of file when its not an executable. It will then create a new process passing the file name to the viewer/editor. See http://support.microsoft.com/kb/307859 for more info.
OR if by open, you mean making your WPF application the default program associated with .pas files. Then you need to make a few registry changes. This SO question provides the details.
OR if by open, you mean reading the file, then try System.IO.File.ReadAllLines or System.IO.File.ReadAllText. More info at File method.

string[] lines = File.ReadAllLines("C:\input.pas");
For more information about File class, have a look at the resource here:
http://msdn.microsoft.com/en-us/library/system.io.file%28v=vs.110%29.aspx

May be below code would help
using System.IO;
FileStream fileStream = new FileStream(#"C:\input.pas", FileMode.Open);

Related

file path shortener c# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
So I am using the StreamReader class, and in the spot where my address goes I have #"S:\Temporary Shared Space\Project\Boyscout3\Data\full_pack.txt" My colleague believes that instead of typing out that super long filename there is a short way of getting it done. My colleague believes that you can just put in #"full_pack.txt*" and it will look for all file names in your computer that has that name. Is my colleague crazy or is this an actual thing?
My colleague believes that instead of typing out that super long filename there is a short way of getting it done.
It depends on what context you are executing the program in. You can use a relative path to make the string shorter (and more flexible).
My colleague believes that you can just put in #"full_pack.txt*" and it will look for all file names in your computer that has that name.
I don't know why you added a * but unless you are using a search method you will need to remove that character. "full_pack.txt" that will grab full_pack.txt from the current directory, wherever that is.

C# windows form save recently browsed file history [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I wrote an app in C# which allows user to select a directory and does some simple things on the files in the directory. Now I want to add a ListBox to it that saves the most recent 5 selected directories. I don't want to hook up my app to a db because it's a very simple app. I can save the values to a txt file but I don't think that's the best practice. Is there any built-in features in Visual Studio Windows Form Application which allows me to do that? (I tried *.resx file and it doesn't seems to work for such purpose.)
The use of Settings can do this feature. It is so sample just go to the project properties and add a new propertie with type StringCollection .
You can manipulate this propertie like a sample collection by add ‚remove paths.
Take a look in this tutorial : http://blog.csharphelper.com/2011/08/18/use-a-setting-that-contains-a-string-collection-in-c.aspx

File upload and download on Azure [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I want have my azure . NET web application upload a file, manipulate it and then download the changed version.
Should I use blob storage? I don't actually need to store the data in the file.
Should I use blob storage?
That depends on what your requirements are.
I don't actually need to store the data in the file.
Given this fact, you probably don't need to use blog storage.
You could simply do something like this:
var postedFile = Request.Files[0] as HttpPostedFileBase;
var stream = new MemoryStream();
postedFile.InputStream.CopyTo(stream);
// work with MemoryStream
...
//return your file which could be different based on mvc, web forms or whatever

Maintenance Program with a txt file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to write an employee maintenance program (in C#) that can add, change and delete from a text file. I have the HTML all put into an .aspx file but I have NO clue on how to set it up to read from a text file and populate the input fields with the employee to maintain.
If I could get some insight on how to read a text file and populate the input fields(form fields) that would be great. Even a link that explains it since I haven't been able to find one. The text file will have to have a record ID as the first field so I know which one to grab for editing(to display) or deleting.
There's a toolkit of functions to manipulate files in the system.io.file class. That's a reasonable start for the project.
You might also consider using a database instead of a text file. They're designed to handle storage and retrieval of data that changes a lot. A text file is doing it the hard way.

I want to display icon of running process with its name when i am displaying the list to running process in C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Hi I am working on windows form.
I am displaying the number of running processes across multiple virtual desktops..It is working fine. no problem in that. Please see the image...
Now i want to display the icon of respective process with name.
So can anyone tell me it is possible or not.
If YES then please give some idea. so i can achieve it.
Thanks for helping me.
You can get the icon using Icon.ExtractAssociatedIcon
foreach (var process in Process.GetProcesses())
{
var icon = Icon.ExtractAssociatedIcon(process.MainModule.FileName);
}
See: Get File Icon used by Shell for more information about icons.

Categories

Resources