0
Answer

saving multiple pictureboxes and labels or textboxes as one

Marvin kakuru

Marvin kakuru

10y
1k
1
hi there,
 i hope your all ok . i am working on a project and i am trying to save mulitple picture boxes and labels as well textboxes into one single picturebox.
below is a sample of what iam trying to do.

 
 the bigger rectangle represents my picturebox1, the second biggest rectangle is picturebox2, the smallest rectangle is my picture box3, name and telephone can be label or textbox. i am trying to capture all the above as one picture
below is the code i am currently using to save my picture box1 to my access database.
 
{
 

OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MpokyaRegistration\MpokyaRegistration\bin\Debug\mpokyadata.accdb;Jet OLEDB:Database Password=Kireemba");

conn.Open();

string insertString = "insert into evicteeid (refno,uniqueno,cid) values ('" + label1.Text + "','" + label2.Text + "',@blob)";

OleDbCommand cmd = new OleDbCommand(insertString, conn);

MemoryStream ms = new MemoryStream();

Image img = (Image)pictureBox1.Image.Clone();

img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

cmd.Parameters.Add("@blob", ms.ToArray());

cmd.ExecuteNonQuery();

conn.Close();

}
 
any help will be greatly appreciated