Monthly Archives: Ekim 2012

You are browsing the site archives by month.

C# Mdi Form Kullanımı


       private void CheckMdiChildren(Form form)
        {
            foreach (Form frm in this.MdiChildren)
            {
                if (frm.GetType() == form.GetType())
                {
                    frm.Focus();
                    return;
                }
            }

            form.MdiParent = this;
            form.Show();
        }


            Form1 yeniform = new Form1 ();
            CheckMdiChildren(yeniform );

.NET ile Event İşlemleri


            try
            {
                  //işlemler
            }
            catch (Exception ex)
            {
                EventLog log = new EventLog();
                log.Source = "Application";
                log.WriteEntry(ex.Message, EventLogEntryType.Error, 200);

            }

.Net ile Binary Resim Okuma


            byte[] resim = (byte[])dt.Rows[0]["Resim"];
            MemoryStream stream = new MemoryStream(resim);
            pictureEdit1.Image = System.Drawing.Image.FromStream(stream);

C# ile İnternet Bağlantı Kontrolü

        public class InternetCS
        {
            [DllImport("wininet.dll")]
            private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
            public static bool IsConnectedToInternet()
            {
                int Desc;
                return InternetGetConnectedState(out Desc, 0);
            }
        }


        private void button1_Click(object sender, EventArgs e)
        {
            if InternetCS.IsConnectedToInternet() == true

                {
                  MessageBox.Show("bağlantı var");
                }
        }