Loading embedded resource .rtf file into richtextbox on load C# - c#-4.0

Ok so I read about loading an embedded rtf into a rich text box and I am trying to do it when the form loads. The form is not the main form, it is a second form that loads when a control is clicked. This is what I have on the form when it loads:
private void Credits_Load(object sender, EventArgs e)
{
Assembly creditAssm = Assembly.GetExecutingAssembly();
using (Stream creditStream =
creditAssm.GetManifestResourceStream("YDisplayView.credits.rtf"))
{
creditsRichTextBox.LoadFile(creditStream, RichTextBoxStreamType.RichText);
}
}
In the solution explorer the rtf file shows as a resource and the build action is set to embedded resource.
when I click the button to load the form, it shows as expected, but nothing happens. The contents of the rtf doesn't seem to show :/
I can only assume I am doing it wrong :(
Any help for this newbie would be appreciated.

I figured it out:
creditAssm.GetManifestResourceStream("YDisplayView.credits.rtf"))
needed to be:
creditAssm.GetManifestResourceStream("YDisplayView.Resources.credits.rtf"))
Edit: For some reason this time around I can't get the above code to work but I found another one that did so hopefully either/or will be of some help to new coders out there :)
string rtf = yourAppName.Properties.Resources.yourEmbeddedRTFName;
yourRichTextBox.Rtf = rtf;

I wanted to create an rtf help file named Help.rtf and have it stored as a resource and so it could be loaded when a Help form was loaded without having a Help.rtf hanging around the application folders.
I found I needed to add the rtf file to the resources through the menu's Project-> 'Your name space' Properties... then navigate to Resources tab, then Add Item etc etc... before the intellisense would offer the rtf file in it's drop-down list when I typed 'My.Resource.' Now, the list of resources including the Help file I added shows up (without extension, which is normal).
In short, once this was done, then the following worked:
RichTextBox1.rtf = My.Resources.Help
Apparently it wasn't enough just to Drag&Drop, Copy or even add the file using the 'Solution Explorer'!
Spent 3 days on this problem so I hope someone finds it usefull.

Related

Acumatica - Copy Paste Function not working on Rich Text

I added the copy-paste function to the tasks screen (CR306020) but somehow the detail section richtextbox of it wasn't being copied.
I tried to override the PXSelect view of it by removing the
[PXCopyPasteHiddenFields(typeof(CRActivity.body))]
and declared it as a public new PXSelect. but somehow it doesn't work.
any suggestion or ideas on how to make it work would be appreciated.

Userform multipage does not refresh

I'm working on a VBA application that consists of few pages on multipage.
I have a list of items on page 0 and when I click on that item, Excel should move to a different page.
The code:
Userform1.MultiPage1.Value = 1
This does not happen. Page 1 is not shown even though it is selected (tab on top of the multipage is selected).
I have quite a bit of code prior to above shown code and everything seems to be working.
I have read on Google that the problem could be due to declaring the same variable more than once. Code checked and looks ok now.
I also read that the form can be corrupted. I hope it isn't because there is a lot of stuff on it.
Any idea why the multipage doesn't change the page and how to fix it?
On attached picture you can see that the multipage has changed from 'page1' to 'video_exhibit', however it did not update the view. just stayed on the same page.
Multipage was working prior to this stage of the application.
I shared the files on Google drive at https://drive.google.com/drive/folders/12LTuaMoQ-HpI1z8g9F2419dHvHQU4f_4?usp=sharing
uploaded are: rar, zip and exports from app. userform and modules.
I'm aware there is lots to fix and unnecessary loops, but this can wait as I just need a draft working.
Thank you for your help.
So, after spending whole night trying to fix it, I decided to create new Userform and copy all the stuff on it. It works!
I've asked if the problem could be due to file being corrupted and it looks like this was the reason. Userform1 was behaving strangely and I could not understand it.
So unless someone will find different reason for the bug, the official version is - Userform1 was corrupted.

Copying and Renaming xhtml file to new file in JSF causing data does not load

I received an assignment to have a look at Java Server Faces project and maintain the existing code if possible. My background is ASP.net , and never made a Java program previously. The problem is like this : there is existing file code named policy_list.xhtml (with also several beans attached to UI component in the file) and lets say it attach to menu Policy List. If user click the menu, the policy_list.xhtml will show the list of Policy. I copied the policy_list.xhtml file and renamed it to a new file renewal_list.xhtml. And I created a new menu Renewal List and attach the link to renewal_list.xhtml. I did not make any changes to renewal_list.xhtml. However , when I click the Renewal List menu, the page did not show any data like the Policy List menu. There is no error shown in the page What is wrong with the Renewal List page. Is it the behaviour of JSF ? On the IntelliJ IDEA debugger, I have not found any error. However the Search button in the renewal_list.xhtml working fine just as policy_list.xhtml. All the action link in the dataTable does not work in renewal_list.xhtml. I guess I am missing as particular setup on the menu or else ? Any ideas ?
My God, I have to registered it on pages.xml . Now, its working. Thanks to the powerful search of IntelliJ idea.

Transfer a file to a web page via browse button

I want to fill in a form in VBA. I can fill everything empty field and set the drop down menus. However I couldn't find a way to put a file in the browse button.
The code for this button is:
I tried something like this
IE.Document.getElementById("browseFiles").Value = "C:\Users\nx\Documents\BCAM development.docx"
or
IE.Document.getElementById("fileElement").Value = "C:\Users\nx\Documents\BCAM development.docx"
As expected it didn't work even though it doesn't give me any error.
Do you know if it is possible to transfer a file like this?
Thank you in advance!

Command Not Handled Exception

I'm new to Domino Designer. I'm trying to modify an existing application which is running on a remote server. I create a blank xPage and view in browser and it works. I add a label and view in browser and it works. I add a combo box and setup a data source for my xPage. The data source is in the current application and I'm using a view. I setup my combo to point to that data source and specify BindTo value. I view it in browser and I get Error 500 "HTTP Web Server: Command Not Handled Exception" I can open the view that I've used and see all the data in the view. I can even add, edit, and delete from the view.
Ideas... Thnxs in advance.
Additional Info. I've added a "View" from "Container Controls" and used the same data source and the same view and it also works in the browser.
The error being printed is:
javax.faces.el.PropertyNotFoundException: Error getting property 'CompanyName' from bean of type lotus.domino.local.View
com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:119)
com.ibm.xsp.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:144)
com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:182)
com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:163)
com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.j‌​ava:257)
com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:150) ....
This was already answered in the comments, but I want to write a better answer.
The problem in this case is that a view data source is being used for editing a document. Directly, this is not a possibility, though there are a few great ways to get around this. The first way, and my favorite, is to use an inline form. I think the Extension Library Demo database offers a few great examples of how to go about doing this. One way is to use a tooltip dialog. Another way is an inline form. A repeater is used and for every row in the view, a hidden panel can be made which contains the document data source and all field which are required to be changeable. By clicking on a button or link, the panel is made visible. This is my favorite variant because it is simple, quick, and generally looks great.
Another way to go about this is to have a view data source only, but use scripts to retrieve the document and set the values in the background and then save and release. It all depends on what you are trying to achieve.
My main recommendation is to look at the ExtLib demo and take a look at what they are doing there.

Resources