Esempio n. 1
0
        public image(string std_no)
        {
            InitializeComponent();

            std st = new std();

            st.stdno = std_no;

            SqlDataReader dstdr;

            try
            {
                dstdr = st.Selectimg();

                while (dstdr.Read())
                {
                    if (!dstdr.IsDBNull(0))
                    {
                        byte[]       photo1 = (byte[])dstdr[0];
                        MemoryStream ms     = new MemoryStream(photo1);
                        pictureBox1.Image = Image.FromStream(ms);
                    }
                    else
                    {
                        pictureBox1.Image = null;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("در اطلاعات این دانشجو عکس موجود نیست", "توجه    ", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }
        }
Esempio n. 2
0
        private void ShowPosition()
        {
            // Display the current position
            // and the number of records
            //txtRecordPosition.Text = (objCurrencyManager.Position + 1) + " of " + objCurrencyManager.Count;
            //toolStripStatusLabel1.Text = "آماده عملیات";
            txtstdno.Enabled = false;

            std st = new std();

            st.stdno = txtstdno.Text;

            SqlDataReader dstdr;

            try
            {
                dstdr = st.Selectimg();

                while (dstdr.Read())
                {
                    if (!dstdr.IsDBNull(0))
                    {
                        byte[] photo1 = (byte[])dstdr[0];

                        MemoryStream ms = new MemoryStream(photo1);
                        img_axbox.Image = Image.FromStream(ms);
                        //pictureBox1.Enabled = true;
                    }
                    else
                    {
                        img_axbox.Image     = null;
                        pictureBox1.Enabled = false;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("در اطلاعات این هنرجو عکس موجود نیست", "توجه    ", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }

            flag = false;
        }