Hello out there! I need to add .png files and set them to embedded in a resx file programmatically. The .png file may or may not be already in the resx. Here's what I've tried. No errors occur when I run the code, but the file is not put into the .resx. Thanks very much for the help!!
try { for (int i = 0; i < m_pngFileNames.Length; i++) { Image image1 = Image.FromFile(m_pngFileNames[i]);
string imageName = Path.GetFileName(m_pngFileNames[i]);
System.Resources.ResXResourceWriter rsxw = new System.Resources.ResXResourceWriter(m_resxFile);
rsxw.AddResource(imageName, ConvertImageToByteArray(image1, ImageFormat.Png));
rsxw.Close();
} } catch (Exception ex) { MessageBox.Show(ex.Message); }
Best Regards!