Click here to Skip to main content
15,906,645 members
Home / Discussions / C#
   

C#

 
GeneralRe: Shared Methods? Pin
Guffa9-Feb-06 5:56
Guffa9-Feb-06 5:56 
QuestionConvert file extension to mime type Pin
Uwe Keim9-Feb-06 3:48
sitebuilderUwe Keim9-Feb-06 3:48 
QuestionC# TreeView Pin
2dS9-Feb-06 3:45
2dS9-Feb-06 3:45 
AnswerRe: C# TreeView Pin
Andy Moore9-Feb-06 5:28
Andy Moore9-Feb-06 5:28 
GeneralRe: C# TreeView Pin
2dS9-Feb-06 20:09
2dS9-Feb-06 20:09 
QuestionHow to open large database? Pin
Pius__X9-Feb-06 3:10
Pius__X9-Feb-06 3:10 
AnswerRe: How to open large database? Pin
Colin Angus Mackay9-Feb-06 3:26
Colin Angus Mackay9-Feb-06 3:26 
AnswerRe: How to open large database? Pin
Le centriste9-Feb-06 4:20
Le centriste9-Feb-06 4:20 
AnswerRe: How to open large database? Pin
emran8349-Feb-06 10:26
emran8349-Feb-06 10:26 
QuestionWizard; Hiding a WizardStep Pin
ZeedijkMike9-Feb-06 3:00
ZeedijkMike9-Feb-06 3:00 
Questionabout axwebbrowser Pin
smr859-Feb-06 2:40
smr859-Feb-06 2:40 
Questiontext box & GO button Pin
Kola Sokol9-Feb-06 1:43
Kola Sokol9-Feb-06 1:43 
AnswerRe: text box & GO button Pin
Judah Gabriel Himango9-Feb-06 5:27
sponsorJudah Gabriel Himango9-Feb-06 5:27 
GeneralRe: text box & GO button Pin
Kola Sokol9-Feb-06 7:36
Kola Sokol9-Feb-06 7:36 
GeneralRe: text box & GO button Pin
Kola Sokol9-Feb-06 8:08
Kola Sokol9-Feb-06 8:08 
QuestionReflection -VectorClass :System.IO.FileNotFoundException Pin
sasire189-Feb-06 1:34
sasire189-Feb-06 1:34 
Question!= Operator Cant be applied Error Pin
emran8349-Feb-06 1:01
emran8349-Feb-06 1:01 
AnswerRe: != Operator Cant be applied Error Pin
Le centriste9-Feb-06 1:38
Le centriste9-Feb-06 1:38 
GeneralRe: != Operator Cant be applied Error Pin
emran8349-Feb-06 2:05
emran8349-Feb-06 2:05 
GeneralRe: != Operator Cant be applied Error Pin
Le centriste9-Feb-06 2:08
Le centriste9-Feb-06 2:08 
QuestionResource files Pin
AB77719-Feb-06 0:55
AB77719-Feb-06 0:55 
AnswerRe: Resource files Pin
emran8349-Feb-06 1:10
emran8349-Feb-06 1:10 
Hi,
I can show you the way I am using and it is working fine with me.

I added image files from "Add existing Items" Under Project Name of Solution Explorer.
then, I am using a method to poplulate a picture box from Resource.

fillPicBoxFromResource(ref picBoxGoHome, "Images.home1.gif"); // Images was the name of the Folder where I kept images under Project.
you can use this way too,

fillPicBoxFromResource(ref picBoxGoHome, "home1.gif"); // Images was the name of the


private void fillPicBoxFromResource(ref PictureBox pB, string resourcePath)
{
Stream imgStream = null;
// get a reference to the current assembly
Assembly a = Assembly.GetExecutingAssembly();
// get a list of resource names from the manifest
string[] resNames = a.GetManifestResourceNames();
foreach (string s in resNames)
{
if (s.EndsWith(resourcePath))
{
imgStream = a.GetManifestResourceStream(s);
if (!(null == imgStream))
{
pB.Image = Bitmap.FromStream(imgStream) as Bitmap;
imgStream.Close();
imgStream = null;
}
}
}
}


Another Alternative :
Select the picture box and Choose Picture you want to add to resource. Click Project Resource , ( not local resource). Then change the picture and keep on adding pictures in Project resource.
Now, this one liner will load the picture from resource to Picture box.

this.pictureBoxName.Image = global::ProjectName.Properties.Resources.pictureName;

pictureName will be easily found from Intellisense.

Hope this solution will help you.

EMRAN


-- modified at 7:16 Thursday 9th February, 2006
GeneralRe: Resource files Pin
AB77719-Feb-06 1:25
AB77719-Feb-06 1:25 
GeneralRe: Resource files Pin
emran8349-Feb-06 2:00
emran8349-Feb-06 2:00 
GeneralRe: Resource files Pin
AB77719-Feb-06 2:12
AB77719-Feb-06 2:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.