473,606 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resources.

Hi.

I have embedded resource file "hr.html" added to my project.
How to load it to a String varaible named "strht"?

Thanks,
Doker
Jul 21 '05 #1
1 860
It will be something like this:
Dim fname as string = "your app name goes here" & ".hr.html"
Dim sra As Reflection.Asse mbly =
Reflection.Asse mbly.GetExecuti ngAssembly
Dim str As IO.Stream = sra.GetManifest ResourceStream( fname)
Dim buf() As Byte
ReDim buf(CInt(str.Le ngth) + 100)
str.Read(buf, 0, CInt(str.Length ))
Dim s as string =
Text.Encoding.D efault.GetStrin g(buf,0,cint(st r.length))
' at this point, string s should contain the contents of your file
This code is a cut/paste/edit of some of my code that works for wav files as
embedded resources. But I have edited it, so you may need to tinker. If
your project is "foo" and you have added file as a resource as simply as
possible, then the value of fname should be "foo.hr.htm l". You may need to
fiddle with the Text.Encoding line because that one I just winged.

"Doker" wrote:
Hi.

I have embedded resource file "hr.html" added to my project.
How to load it to a String varaible named "strht"?

Thanks,
Doker

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2863
by: Derick Smith | last post by:
Hi! I am just starting to use .NET and need some help! If I create my own DLL for String resouces using this command: C:\WINNT\MICROS~1.NET\Framework\v1.1.4322\Al /t:lib /embed:resourceString.fr-ca.resources, /culture:fr-ca /out:Example2.resources.dll C:\WINNT\MICROS~1.NET\Framework\v1.1.4322\Al /t:lib /embed:resourceString.resources, /out:Example2.resources.dll
3
12640
by: Jesse | last post by:
Hi together, I've a problem with compiling an application with a build-Script and run it after. Several resource-files I compile with resgen.exe and put the files into a folders of the language. (en\*.resources, en-US\*.resources ...) With al.exe I generating several dlls with the format applicationname.resource.dll (in every language-folders one dll)
1
2285
by: Stefan Turalski \(stic\) | last post by:
Hi, What I need to do is adding some support for resources files to my application. What I did is: MyAppMain <- startup project MyAppHelper <- project which has MyAppResourcesClass (al a library project) This class call methode : ResourceManager MyAppResourceManager = new ResourceManager("MyAppMain.Resources", Assembly.GetExecutingAssembly()); and I obtain error which tell that there is no propertly added
4
39977
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that deals with managed in one place, and code that deals with unmanaged in another place, but I can't seem to find anything that clearly explains what that means. I think if I used a Windows API function to optain a handle, that handle would be an...
4
5877
by: Jon Rista | last post by:
I have a project where I need to create a windows .exe by compiling code and linking in some resources. This program thats being generated is somewhat unconventional, and I'll explain how. I'm generating a very simple installer app that embeds referenced .dll files inside it, which are extracted and referenced when the installer app is executed. This works great when the installer app is built with Visual Studio .NET, but it does not work...
0
2189
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have multiple web forms. When you compile the application, it creates a DLL. If you view this DLL using ILDASM (the manifest), it shows info about the resources stored in the DLL. There is essentially an embedded resource "section" for each web form. The...
0
982
by: Derick Smith | last post by:
Hi! I am just starting to use .NET and need some help! If I create my own DLL for String resouces using this command: C:\WINNT\MICROS~1.NET\Framework\v1.1.4322\Al /t:lib /embed:resourceString.fr-ca.resources, /culture:fr-ca /out:Example2.resources.dll C:\WINNT\MICROS~1.NET\Framework\v1.1.4322\Al /t:lib /embed:resourceString.resources, /out:Example2.resources.dll
0
9156
by: Rob Dob | last post by:
Hi, I have a VS2003 C# asp.net project that has been converted into a VS2005 project. Everything seemed to work well until I make a modification to anything within the Component Designer window, i.e. I add a SQLCommand. At that point VS2005 changes my C# file to now load all Selectcommantext data from the resource file instead of the .aspx.cs file. then when I try and once again run my application I get the following error: looking...
1
3202
by: spencermiles | last post by:
Hello, I'm working on a large solution, comprised on numerous Projects, and I would like to have one central projects that contains a set of global RESX Resources. It doesn't make sense to have various resources (strings, images, etc...) scattered through the application; having them all in one central area will be a huge boon. The problem that I'm running into is being able to access these resources from external assemblies. I have...
0
3656
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET. · When was the first version of .NET released? The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on...
0
8024
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7959
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8105
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6781
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3942
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3987
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2451
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.