How to display an image from listbox in WPF?
Sapna
Select an image from your device to upload
Hi sapna
This click here to resolve your problem.
http://www.c-sharpcorner.com/UploadFile/mahesh/WPFListBox07312008002559AM/WPFListBox.aspx
Thanks
Write the following in the onSelectedIndexchanged event of listbox SqlConnection con=new SqlConnection(); //set the connection string below con.ConnectionString = ""; //set the ID in the below code to the name in the listbox instead of hardcoded value SqlCommand cmdSelect = new SqlCommand("select Picture" + " from TableName where ID=@ID",con); cmdSelect.Parameters.Add("@ID",SqlDbType.Int, 4); //set the id below cmdSelect.Parameters["@ID"].Value = "2";
con.Open(); byte[] barrImg = (byte[])cmdSelect.ExecuteScalar(); string strfn = Convert.ToString(DateTime.Now.ToFileTime()); FileStream fs = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write); fs.Write(barrImg, 0, barrImg.Length); fs.Flush(); fs.Close(); Image1.Image =System.Drawing.Image.FromFile(strfn);
Hi,Anybody help me to solve this problem. Suppose I have a list box with different types of dishes with their images but in the listbox only their names to be shown. Then if i select a dish from the listbox its image should be display outside the listbox.
Thanx