is it possible to add a rich-text file to my project and then load it to a rich textbox by code? I'm confused!!!! I added teh file to the project, but I have no idea how to load it
btw the reason that I wanna do this is because I can't format/colorize the text inside the rich textbox during design time. So I thought I have to make a file with msword and then load it at runtime. is this the right way though?
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB ) VB.NET to C# conversion tips!!
I dont want the user to load the file. I want the file to be automatically loaded. AND I dont want teh file to be outside the project, I want it to be a part of my project included in the exe file (a resource or whatever?)
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB ) VB.NET to C# conversion tips!!
Ok, I've hit a stump . Loading images is pretty simple, but the *.rtf file is giving problems. I'm off from work tommorow, so I'll see what I can do in the morning.
thanks for helping... I just dont know why the heck they didnt provide a way for the user to copy/paste something with rtf format at design time.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB ) VB.NET to C# conversion tips!!
Ok I finally figured out how to do it. Did'nt realize it was so easy. It only took me three lines of code to do it.
No this is a 2 step process. First you have to create the resource (this is hardest part if you have to write the code yourself), then you have to add that resource to your program. Now since I'm going to be doing this more often, I've created a program to write the resource file for. Right now it only supports text files but I'll add image and icon file support later.
Now comes the easy part. After you have created your resource file, you just add it to project. Go to the solution explorer and right click -> add existing items, then select the resource file that you created.
Now loading the resource is very simple
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'We are loading the resource thats in the executing assembly
'ResourceExample.Template is the resource file
'ResourceExample is the executing assembly's namespace, and Template is the first part of the Template.resources
'So, in any program, it would be <name of the executing assembly's namepace>.<first part of filename.resources>
Dim rm As New ResourceManager("ResourceExample.Template", [Assembly].GetExecutingAssembly())
'Loading the string resource based on the internal name given to the resource when it was firsted created
RichTextBox1.Rtf = rm.GetString("Template")
'Release all resources
rm.ReleaseAllResources()
End Sub
Hope that helps. I've included the example, plus the Resource Writer.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB ) VB.NET to C# conversion tips!!
Thats right PT. Its a two step process. Seems kind of strange though that MS would do something like this. Thats why I made a separate program just to make the resource files.
Here is the code to generate a resource file with strings
Code:
ResourceWriter rw = new ResourceWriter("Test.resources");
rw.AddResource("1","This is a Test 1");
rw.AddResource("2","This is a Test 2");
rw.AddResource("3","This is a Test 3");
rw.Generate();
rw.Close();