So I want my program to open up an empty notepad window, and then fill it in and let the user save it as whatever they want. Is this possible in VB .NET, and if so, do you have any pointers?
Note: I don't want to save to write to a file and then save it. I know how to do that. I want to write to a notepad window (an unsaved file).
I hope this makes sense and I hope it's possible. Thanks for your help as always!
Write to an Open (unsaved) Text File
Page 1 of 16 Replies - 1543 Views - Last Post: 09 July 2010 - 12:23 PM
Replies To: Write to an Open (unsaved) Text File
#2
Re: Write to an Open (unsaved) Text File
Posted 08 July 2010 - 12:48 PM
Yeah, I have an idea, but it's reallllyyy messy and unlikely to work... but still, here we go!
Process.Start("notepad.exe")
Dim found As Boolean = False
Do Until found = True
System.Threading.Thread.Sleep(100)
For Each p As Process In Process.GetProcesses
If p.ProcessName = "notepad" Then
found = True
End If
Next
Loop
SendKeys.Send("Whatever you want to say..." & Environment.NewLine & "And you can make new lines too!")
This post has been edited by Jack Eagles1: 08 July 2010 - 03:15 PM
#3
Re: Write to an Open (unsaved) Text File
Posted 08 July 2010 - 01:32 PM
Sorry about that, I missed a important part in the first post. Very sorry.
This post has been edited by NemY: 08 July 2010 - 01:43 PM
#4
Re: Write to an Open (unsaved) Text File
Posted 09 July 2010 - 11:07 AM
Thanks for your help, guys. I guess there may be no clean solution to this. Anyone else have any ideas?
#5
Re: Write to an Open (unsaved) Text File
Posted 09 July 2010 - 11:36 AM
I've looked. I can't find that notepad has any command line parameters for this kind of thing. At best, you'll be able to do it in a very hacky way, like focusing the window and sending keystrokes. Probably not the best way of doing things.
Are you married to using Notepad though? It's pretty easy to "recreate" notepad as a form in your application. You could give it all the same behaviors.
Are you married to using Notepad though? It's pretty easy to "recreate" notepad as a form in your application. You could give it all the same behaviors.
#6
Re: Write to an Open (unsaved) Text File
Posted 09 July 2010 - 11:49 AM
#7
Re: Write to an Open (unsaved) Text File
Posted 09 July 2010 - 12:23 PM
Maybe I'm missiong something but isnt the point to allow the user to save text. Why not create a quick RTF editor and and allow him to save it?
Why use notepad at all?
Why use notepad at all?
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|