Click here to Skip to main content
16,010,334 members
Home / Discussions / C#
   

C#

 
GeneralRe: Autofill Dropdownlist Pin
MyThread3-Feb-05 6:22
MyThread3-Feb-05 6:22 
Generaldiffrent results everytime Pin
Ahmed Galal3-Feb-05 1:42
Ahmed Galal3-Feb-05 1:42 
GeneralRe: diffrent results everytime Pin
Christian Graus3-Feb-05 8:37
protectorChristian Graus3-Feb-05 8:37 
Generalbitmap background issue and resources Pin
Aviv Halperin3-Feb-05 0:48
Aviv Halperin3-Feb-05 0:48 
GeneralRe: bitmap background issue and resources Pin
Judah Gabriel Himango3-Feb-05 5:03
sponsorJudah Gabriel Himango3-Feb-05 5:03 
GeneralRe: bitmap background issue and resources Pin
Aviv Halperin3-Feb-05 6:48
Aviv Halperin3-Feb-05 6:48 
GeneralRe: bitmap background issue and resources Pin
Christian Graus3-Feb-05 8:41
protectorChristian Graus3-Feb-05 8:41 
GeneralRe: bitmap background issue and resources Pin
Aviv Halperin3-Feb-05 22:57
Aviv Halperin3-Feb-05 22:57 
Thanks.
I changed the code a bit since it did not work properly.
My code is:

public static Bitmap GetImageFromResources(string name)
{
// get a reference to the current assembly
System.Reflection.Assembly a = Assembly.GetExecutingAssembly();

string my_namespace = a.GetName().Name.ToString();//not needed since return assembly name

string[] ResourceNames = a.GetManifestResourceNames();
string ImageFullName="";

for(int i=0 ; i < ResourceNames.Length ; i++)
if(ResourceNames[i].ToUpper().IndexOf(name.ToUpper()) != -1)
{
ImageFullName = ResourceNames[i]; break;
}

Bitmap image =
new Bitmap(a.GetManifestResourceStream(/*my_namespace + "." +*/ ImageFullName));

return image;
}

Problem was that a.GetName().Name.ToString(); does not return the name space in which the code is running but rather the assembly name.

Thanks again.

avivhal
GeneralODBC Programming Pin
Adnan Siddiqi2-Feb-05 23:45
Adnan Siddiqi2-Feb-05 23:45 
GeneralRe: ODBC Programming Pin
Heath Stewart3-Feb-05 0:17
protectorHeath Stewart3-Feb-05 0:17 
GeneralMulti-monitor Pin
SquallBlade2-Feb-05 23:19
SquallBlade2-Feb-05 23:19 
GeneralRe: Multi-monitor Pin
Heath Stewart2-Feb-05 23:23
protectorHeath Stewart2-Feb-05 23:23 
GeneralTransparent tabcontrol Pin
Member 8094092-Feb-05 22:54
Member 8094092-Feb-05 22:54 
GeneralReflection question Pin
Christian Graus2-Feb-05 18:25
protectorChristian Graus2-Feb-05 18:25 
GeneralRe: Reflection question Pin
Robert Rohde2-Feb-05 20:15
Robert Rohde2-Feb-05 20:15 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 10:09
protectorChristian Graus3-Feb-05 10:09 
GeneralRe: Reflection question Pin
Heath Stewart2-Feb-05 23:19
protectorHeath Stewart2-Feb-05 23:19 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 10:08
protectorChristian Graus3-Feb-05 10:08 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 11:00
protectorChristian Graus3-Feb-05 11:00 
GeneralRe: Reflection question Pin
Heath Stewart3-Feb-05 11:10
protectorHeath Stewart3-Feb-05 11:10 
GeneralRe: Reflection question Pin
Christian Graus3-Feb-05 11:13
protectorChristian Graus3-Feb-05 11:13 
GeneralComputer name and IP Pin
Luis Alonso Ramos2-Feb-05 16:05
Luis Alonso Ramos2-Feb-05 16:05 
GeneralRe: Computer name and IP Pin
mav.northwind2-Feb-05 22:44
mav.northwind2-Feb-05 22:44 
GeneralRe: Computer name and IP Pin
Luis Alonso Ramos3-Feb-05 5:59
Luis Alonso Ramos3-Feb-05 5:59 
GeneralTreeView Pin
Yulianto.2-Feb-05 15:14
Yulianto.2-Feb-05 15:14 

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.