c# 4.0 - Loading embedded resource .rtf file into richtextbox on load C# -
ok read loading embedded rtf rich text box , trying when form loads. form not main form, second form loads when control clicked. have on form when 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 solution explorer rtf file shows resource , build action set embedded resource.
when click button load form, shows expected, nothing happens. contents of rtf doesn't seem show :/
i can assume doing wrong :(
any newbie appreciated.
i figured out:
creditassm.getmanifestresourcestream("ydisplayview.credits.rtf"))
needed be:
creditassm.getmanifestresourcestream("ydisplayview.resources.credits.rtf"))
edit: reason time around can't above code work found 1 did either/or of new coders out there :)
string rtf = yourappname.properties.resources.yourembeddedrtfname; yourrichtextbox.rtf = rtf;
Comments
Post a Comment