korasoglu Posted August 23, 2016 Share Posted August 23, 2016 Arkadaşlar değişkene tanımlayarak formları nasıl açtırabilirim. Form2 d = new Form2(); d.ShowDialog(); bu şekilde değilde değişken özerinden açılmasını istiyorum. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted August 23, 2016 Share Posted August 23, 2016 aşağıdaki örnekte bir form oluşturuyor, bir button oluştuyor, buttonu form'a ekliyor ve formu açıyor: Form frm = new Form() { Size = new Size(300, 200), Location = new Point(300, 100) }; Button btn = new Button() { Text = "düğme" }; frm.Controls.Add(btn); frm.Show(); 1 Quote Link to comment Share on other sites More sharing options...
korasoglu Posted August 23, 2016 Author Share Posted August 23, 2016 Hocam yine derdimi anlatamadım var olan formları değişkenle açmak istiyorum. Bu kod demetini denerkende Button btn = new Button()Buttonların altını çizdi usinglerden bir şey eksik galiba Quote Link to comment Share on other sites More sharing options...
KintaRo Posted August 23, 2016 Share Posted August 23, 2016 Bir saat önce, korasoglu yazdı: Arkadaşlar değişkene tanımlayarak formları nasıl açtırabilirim. Form2 d = new Form2(); d.ShowDialog(); bu şekilde değilde değişken özerinden açılmasını istiyorum. zaten burada değişken kullanmışsınız. Form2 tipinde d değişkeni kullanmışsınız. Ne yapmak istediğinizi tam olarak söylerseniz ona göre bir yol çizelim Quote Link to comment Share on other sites More sharing options...
korasoglu Posted August 23, 2016 Author Share Posted August 23, 2016 Diyelimki bir function yazsak sabit ben sadece açılacak formun adını göndersem standart olsa nasıl yapılabilir. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted August 23, 2016 Share Posted August 23, 2016 Form formOlustur(string baslik) { Form frm = new Form() { Width = 300, Height = 500, Text = baslik }; return frm; } private void button1_Click(object sender, EventArgs e) { Form form = formOlustur("Merhaba dünya"); form.ShowDialog(); } Quote Link to comment Share on other sites More sharing options...
korasoglu Posted September 4, 2016 Author Share Posted September 4, 2016 Hocam ben derdimi anlatma özürlüyüm aynı kodları tekrar etmektense diyelimki 4 tane formum var ben açılacak formun adını göndersem isteğim form açılsa. Denedim Form2 d = new Form2(); (Form2 yerine değişken yazıyorum kabul etmiyor) mantığına aykırımı ondanmı açmıyor d.ShowDialog(); Yani Form2 d = new Form2(); yerine acilacaksayfam ekl = new acilacaksayfam();diye değişkenle çağırsam olmazmı. Quote Link to comment Share on other sites More sharing options...
Extended Posted September 4, 2016 Share Posted September 4, 2016 (edited) Hide yaptır sonra tekrar göstertirsin formu duruma göre? Edited September 4, 2016 by Extended Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.