[2005] Export notepad doc....
On the click of a button I want to write stuff onto a note pad and open this up so I can copy and paste it to another program...
It's a SQL syntax for every item in a listbox...
So for each item in my list box as string "items" I want to print this with the right items in it's right place... and a line between how can I do this??
Code:
INSERT INTO `travel_photos` ( `id` , `photoname` , `trip_id` , `takenby` , `location` , `details` , `private` , `degrees` , `hits` , `date` , `front` ) VALUES ('', 'items', '11', '', '', '', '0', '0', '0', '0000-00-00', '');
The looping part I can do it's just writing to a text file and opening it up... I don't need it saved anywhere
Re: [2005] Export notepad doc....
So you are saying that your listbox has sql queryies in each item and you want to write them out to a file?
You can write using the System.IO.File class.
Re: [2005] Export notepad doc....
If copy-paste is all you want to do, you can use the Clipboard class.
Re: [2005] Export notepad doc....
No my listbox will have file names.... I'll add the rest of the SQL around the file name. When I click the button I want it to open the notepad and print the SQL statement for each item in the list box in the right place.
Re: [2005] Export notepad doc....
Use the .Tag property of the listbox items to stire the sql text. Then upon selection you can use the .SelectedItem to retrieve the text and the tag for writting to a temp file and process.start with notepad.
Re: [2005] Export notepad doc....
Well, since you stated that you don't need to save the queries to a file but rather just to display it in a notepad, simplest way is to create a form with a textbox with multiline = true and dock = fill. You then can just set the text and show the form. If you are to write your queries to a textfile and open it, you'll need to delete the file when your user is done (and it's hard to detect when the user is done with that file).