Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi my name is vishal.
For 2weeks i have been breaking my head on how to show picturebox datas upon creation in c# windows forms with sql server2008?
I have a picturebox control name:pictureBox1, enabled:true and visible:true
Inside the picturebox are
label control name:lblPID,enabled:true and visible:true
This label control is on top of StrokeScribe control but inside picturebox control
StrokeScribe control name:barCOrg,enabled:true and visible:true
Given below is code on how i generate barcode using StrokeScribe control(barCOrg) in c# windows forms with sql server2008.:
C#
namespace DRRS_CSharp
{
   public partial class frmDialyzer : Form
   {
      int pUserID;
      public frmDialyzer()
      {
         InitializeComponent();
SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }
            string PatientPull = ("select p.patient_id as patient_id,n.patient_first_name as patient_fname,n.patient_last_name as patient_lname from patient_name n,patient_id p where n.patient_id=p.patient_id and n.status =1 and p.patient_id not in (select d.patient_id from dialyser d where d.deleted_status=0)");
            SqlCommand cmd = new SqlCommand(PatientPull);
            cmd.Connection = conn;
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                PatientPull = dr[1].ToString() + "_" + dr[2].ToString() + "(" + "0000" + dr[0].ToString() + ")";
                  cboPatientID.Items.Add(PatientPull);
            }
            dr.Close(); 
      }
      private void button1_Click(object sender, EventArgs e)
      {
         barCOrg.Alphabet = STROKESCRIBELib.enumAlphabet.CODE128;
         barCOrg.CtlText = txtDID.Text;
lblPID.Text = cboPatientID.Text;
         int rc = 0;
         rc = barCOrg.SavePicture("bar2.bmp", STROKESCRIBELib.enumFormats.BMP, barCOrg.Width, barCOrg.Height);
         if (rc > 0)
         {
            MessageBox.Show(barCOrg.ErrorDescription);
         }
         if (MessageBox.Show("Dialyzer detail was added successfully.Do you want to print the barcode dialyzerID?", "DRRS", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
            System.Diagnostics.Process.Start("bar2.bmp");
         }
         this.Close();
      }
   }
}

The above code executes well with no problem at all.

As you can see i save my created barcode image as bar2.bmp. I open my created barcode image in c# windows forms using System.Diagnostics.Process.Start("bar2.bmp");

But when opened my barcode image i get only created image of my StrokeScribe control(barCOrg) but i should also get data of label control(lblPID) along with bar2.bmp which is on top of StrokeScribe control(barCOrg) and both are inside picturebox control(pictureBox1).
I am aware that in order to accomplish this required result i have to use Shell functions.But i dont know what and where to use it.I know i have to do some modifications in my c# code.
Can anyone help me please?Any help/guidance in solving this problem would be greatly appreciated.
Posted
Updated 19-May-14 2:07am
v4
Comments
[no name] 19-May-14 7:55am    
A PictureBox control is not a container for other controls so your label is not "inside" your picture box at all.
gggustafson 19-May-14 10:23am    
+5
Member 10248768 19-May-14 7:59am    
No actually i did it.Could i use panel control instead of picturebox control to achieve my required result then i could put a label control(lblPID) on top of StrokeScribe control(barCOrg). Both label and StrokeScribe control inside a panel.Could it work?Reply please.
gggustafson 19-May-14 10:22am    
As Wes Aday pointed out, you must use a container. In my world (.Net 3.5) the following are defined as containers: FlowLayoutPanel, GroupBox, Panel, SplitContainer, TabControl, and TableLayoutPanel. You must choose the one most satisfactory to your needs.
Member 10248768 20-May-14 0:47am    
Ok I can use a Panel to the same purpose like creating a label control named:lblPID and a StrokeScribe control named:barCOrg inside a Panel control and if i do is it possible to show Panel datas upon creation in c# windows forms with sql server2008 using any shell commands? Reply please.I hope i get a reply from you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900