Vote count:
0
I'm trying to add images already used to an imageList named "Images1". I'm not really good in coding programs but I know that the rest of my program is working except the fact that "Images1" does not exist for the two last voids. I searched to resolve this problem but I have difficulty to find an answer for this specific case.
How can I make my image list "Images1" available for all my private voids?
This is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using System.Globalization;
using System.Resources;
using System.Reflection;
namespace Booster_pack_2
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
List<Image> Images1 = new List<Image>();
ResourceManager rm = Booster_pack_2.Properties.Resources.ResourceManager;
string index1 = textBox1.Text;
Bitmap image1 = (Bitmap)rm.GetObject(index1);
pictureBox1.Image = image1;
Images1.Add((Image)Booster_pack_2.Properties.Resources.ResourceManager.GetObject(index1));
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
ResourceManager rm = Booster_pack_2.Properties.Resources.ResourceManager;
string index2 = textBox2.Text;
Bitmap image2 = (Bitmap)rm.GetObject(index2);
pictureBox2.Image = image2;
Images1.Add((Image)Booster_pack_2.Properties.Resources.ResourceManager.GetObject(index2));
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
ResourceManager rm = Booster_pack_2.Properties.Resources.ResourceManager;
string index3 = textBox3.Text;
Bitmap image3 = (Bitmap)rm.GetObject(index3);
pictureBox3.Image = image3;
Images1.Add((Image)Booster_pack_2.Properties.Resources.ResourceManager.GetObject(index3));
}
}
}
asked 23 secs ago
Aucun commentaire:
Enregistrer un commentaire