private void GetImage(string fullName) { SQLiteConnection sqlite_con = new SQLiteConnection("Data Source=|DataDirectory|dbasedict.s3db;" + "Version=3;New=False;Compress=True;"); String querry2 = "select iimages from dictionario where word = '" + searchBox.Text + "'"; SQLiteDataAdapter adap3 = new SQLiteDataAdapter(querry2, sqlite_con); DataSet set = new DataSet(); adap3.Fill(set, "dictionario"); DataTable dataTable = new DataTable(); dataTable = (DataTable)set.Tables[0]; MemoryStream ms = null; foreach (DataRow row in dataTable.Rows) { int id = Convert.ToInt32(row["iimages"]); byte[ data = (byte[)row["dictionario"]; ms = new MemoryStream(data); } pictureBox1.Image = Image.FromStream(ms); }
public static Image GetImage(string fullName) { Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream file = thisExe.GetManifestResourceStream(fullName); //Image image = Image.FromStream(file); // This won't work with the CF // But this works in both environments! Bitmap image = new Bitmap(file); file.Close(); return image; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)