473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

FilePath to titlebar on fileopen

latitude
Hi, having a problem with streamreader im not to sure how to solve. I have made a text editor, now what i'd like it to do is when i click a textfile in windows - the program opens automatically and views it, but i cant seem to make the path and filename appear in the titlebar of the program. Now this works fine with filestream and by using filestream file = new filestream(etc) and then just file.Name.ToString(); but this option is not included within the streamreader.

I'm guessing i need to use Environment.Commandline to get the args on opening and then somehow strip the result which is: "textviewer.exe" "C:\textfile.tkst", by using substring or indexof. But im having a hard time making this work, if anyone could give me an working example it would be very much appreciated. Following example is how i open the file:

Form1 frm = new Form1();
System.IO.StreamReader myFile = new System.IO.StreamReader(args[0],System.Text.Encoding.Default);
string line = "";
line = myFile.ReadToEnd();
Nov 17 '06 #1
2 1115
Had this one on ice for awhile hoping for a reply here. If theres a guru out there with an answer would be very appreciated!

If someone also can point me to a direction where i can get information on using mutex in C# would be awsome :)
Dec 7 '06 #2
Was easier than i thougt, someone else totally threw me on the wrong track...when i went back to code i simply tried: args[0].ToString()); - and works just fine, now i have 3 ways of getting path to the title...

Problem solved, so may delete this or whatever :p
Dec 20 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: mjakowlew | last post by:
Hi, I'm trying to use some string manipulation from a file's path. filepath='c:\documents\web\zope\file.ext' I need to extract everthing after the last '\' and save it. I've looked around...
2
by: Gregory Hawke | last post by:
What would be the easiest way of painting a titlebar in a form? Setting the background property of a derived System.Windows.Forms.Form only paints the client area. I need to paint the frame as...
4
by: Sam Marrocco | last post by:
Is it possible to place controls such as a checkbox or button in the titlebar of a form? -- ================================================================== Sam J. Marrocco Sr. Visual...
2
by: Jesse Aufiero | last post by:
Hi, I'm trying to create a custom titlebar for my form. I've hidden the form's titlebar by clearing the text property and setting ControlBox=False. This removes the titlebar as desired, but...
10
by: Ammu | last post by:
hi everybody! does anyone know how to get a gradient titlebar in vbdotnet app...? pls help. thanks in advance.
4
by: Jason | last post by:
Its been asked and done before I suspect, but I can't find anything that will work. I'm trying this and it has no titlebar, but shows the calendar on a full page. <a...
1
by: x taol | last post by:
Set dbs = CurrentDb dbs.Properties!AppTitle = "Contacts Database" Application.RefreshTitleBar this code is well working. but form is opend. when the form is maximized, the titlebar name is...
1
by: hisree | last post by:
hi frnds i want full screen window without titlebar, i can use this script, var win =...
1
by: toddkjr | last post by:
I was curious if some may be able to help me?. I currently have a control library and inside I have a TitleBar control. The graphics are all drawn onto the titlebar control. I dont know how to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.