I have created a text file named 'Notes' in the resources of my project and want to load/save the text of a RichTextBox to it. I tried using MyProject.My.Resources.Notes in the path. It doesn't show any error in the code window but when I run it, it shows an error.
Here's what I'm using to load the text:
RichTextBox1.Text = System.IO.File.ReadAllText(MyProject.My.Resources.Notes)
Here's what I'm using for saving it:
System.IO.File.WriteAllText(MyProject.My.Resources.Notes, RichTextBox1.Text)
This is not a duplicate. I did not get an answer from the other question
Why don't you use a regular file which always works fine or a database?
Edit: maybe this helps?
www.dondraper.com/2011/01/easily-save-and-retrieve-application-and-user-settings-in-vb-net-or-c-apps/
Related
I am making a template and thought to store our logo.jpg inside a userform. Then I'll call this userform and insert the logo in the print header for each "macro activated" print.
So far I have managed to print the image only as numbers. Bits and bytes probably(?). I might be missing some conversion of the picture before printing:
FilePageSetupHeader Alignment:=pjLeft, Text:="&P" & UserForm1.Image1.Picture & " "
This prints as: 1-670746914 in the top left header.
What am I missing?
The syntax I found on MSDN gives the following parameters for inserting a picture:
&;P""path"" Inserts the specified image. An example would be &;P"" [My Documents] \Image.gif"". The term [My Documents] represents the full path to your My Documents folder.
My code makes a copy of the current view, make changes to the view settings, headers etc, before exporting to PDF and deleting the view again.
UserForm1.Image1.Picture is a picture object, not the path to the original source file. Once a picture is loaded into an image control, it is embedded and its original path is not stored.
Store the path the the picture so that you can reference it later (e.g. using the Tag property of the Image control). See Stack Overflow: VBA UserForm Get Filename for more details. (FYI: Excel and Project use the same UserForm object, so this is applicable.)
I gave up on saving the logo inside the Project file itself.
Instead I check if the logo exists inside "C:\CompanyLogo", if does not, create that direcotry and download it from imgur.
I have a PDF form that I'm filling out with data using progress-4gl. To date, I've been only filling in text fields using the following syntax:
put stream stream1 unform
"^global CHX_SINGLE_CE_PLAN3" skip(0)
"X" skip
CHX_SINGLE_CE_PLAN3 is the field name...
This code works when dealing with text fields but I'm trying to check a box instead of fill in a text field. I cannot find any documentation on this. Is checking a box on a fillable pdf form even possible with 4gl?
As far as I remember PDF Include has support for filling fillable forms. Whilst it's probably a bit over the top in terms of what you want to achieve, it's an open source project and so you may well find the answer to your question within the code itself.
Here's a link to the project page: http://www.oehive.org/pdfinclude
I discovered the answer, which I thought I had already tried before asking this question. The answer is you need to pass the value "Yes" (with capital "Y") in order to check the checkbox. The correct code in this instance is:
put stream stream1 unform
"^global CHX_SINGLE_CE_PLAN3" skip(0)
"Yes" skip
I believe this is the case no matter which language you're using
So I have a file that has over 100 entries in it as an excel worksheet. I want to put those over into a sql. So I fire up my sql developer and try and import the data but it doesn't show up.
The next and finish buttons don't do anything. (the blue underline words aren't links to anything either fyi)
Have you tried converting the original file to text (csv) then importing? That has worked for me in the past.
I had the same problem and the only way to get rid of it was to rename the preferences folder (as described here: https://www.thatjeffsmith.com/archive/2015/08/how-to-reset-your-sql-developer-preferencessettings/) and start the program with factory defaults.
One more reason is that the CSV or excel file is of 0 kb size or empty.
i am looking at building a pretty simple program that when you browse for a file it only populates the browser with files that have "W2ER" in the file name.
is this possible to do?
right now i have a pretty standard on button click that opens up the folder browser for code.
The Filter Property can deliver what you want. Sample code for OpenFileDialog1:
OpenFileDialog1.Filter = "Files with W2ER in their name | *W2ER*.*"
NOTE: you can replace .* with the extension you want to restrict the search further. Now it looks for files of any type with "W2ER" in any part of their names. *W2ER*.txt would look just for TXT files with "W2ER" in their names.
If it's the standard dialog then
OpenFileDialog1.Filter = "Some Suitable Name | *.W2ER"
More details on MSDN
I would like to create a text file with some data i am manipulating in a script component and write it to a text file. i know how to write it to an existing text file, but what i would like to do is create the text file programmatically so i can name it textfile(TodaysDate).txt
How can i do this??
You can call File.CreateText(someString).
This method returns a StreamWriter which can be used to write to the file.
Remember to close the StreamWriter usinga using statement.
If you start with a sample of the text file that you want stored somewhere, you can use a file system task to copy the sample file to the correct name (make sure you copy so that it's still there for tomorrow). Then use an expression to set the file location in the file connection manager.