Jump to content

Class İşlemleri


korasoglu
 Share

Recommended Posts

Arkaşlar class oluşturup veri gönderip alabiliyorum burada sorun yok. Fakat class dan formdaki nesnele ulaşamıyorum. Diyelimki gönderdiğim veriyi kullandı o veriye göre combo, listbox vb işlem yaptırabilirmiyim yani dönen degeri yazdırım butona tıklama vs olabilirmi.


ListBox public yaptım class da ise nesneye ulaşdım ama ekleme yapmadı

Form1 frm = new Form1();

frm.listBox1.Items.Add(name);

Link to comment
Share on other sites

TestClass.cs:

using System.Windows.Forms;

namespace testler
{
    class TestClass
    {
        public static void Deneme(ListBox lstbx)
        {
            lstbx.Visible = false;
        }
    }
}

class'taki metodumuza gönderilecek değeri ListBox cinsinden ayarladık.

 

daha sonra Form1'den şu komutu gönderdiğimizde Form1'deki listbox1'i görünmez yapacaktır:

            TestClass.Deneme(listBox1);
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...