Tema: Re: C# pasiekt objekta is kitos formos
Autorius: Jornada Del Muerto
Data: 2012-08-10 17:12:35
C# automatu tik objektu pointeriai perduodami.

"dfdf" <dfdf@dfdf.df> wrote in message news:k02rvs$jaa$1@trimpas.omnitel.net...
> nereikia, nebent naudoji paprastus tipus (int, string ir pan), nes 
> perduodama pointeris o ne klonuojama pats objektas
> 
> "ravikas" <rrr@af.asdgd> wrote in message 
> news:op.witk0bx9kwsgap@ramunas-pc.fvs.local...
>> + dar papildomai perduot 'ref' reikia, jei nori paimti kazka paskui
>>
>> public Form2(ref Class1 klase)
>> {
>>             InitializeComponent();
>>             _klase = klase;
>> }
>>
>> On Fri, 10 Aug 2012 12:48:46 +0300, dfdf <dfdf@dfdf.df> wrote:
>>
>>> vietoj
>>> public Form1()
>>>         {
>>>             InitializeComponent();
>>>             Class1 klase = new Class1();
>>>         }
>>>
>>> turetu buti
>>> public Form1()
>>>         {
>>>             InitializeComponent();
>>>             klase = new Class1();
>>>         }
>>>
>>> "Dziedukas" <dejau@gmail.com> wrote in message 
>>> news:k02jrp$90p$1@trimpas.omnitel.net...
>>>> ne,nu jau nervai nelaiko, kame beda???
>>>> public partial class Form1 : Form        //pagrindine forma
>>>>    {
>>>>        public Form1()
>>>>        {
>>>>            InitializeComponent();
>>>>            Class1 klase = new Class1();
>>>>        }
>>>>
>>>>        private void button1_Click(object sender, EventArgs e)    //iki 
>>>> sito dar net nedaeina        {
>>>>            label1.Text = klase.vardas;
>>>>        }
>>>>
>>>>        private void button2_Click(object sender, EventArgs e)
>>>>        {
>>>>            Form2 forma2 = new Form2(klase);
>>>>
>>>>            if (forma2.ShowDialog() == DialogResult.OK)
>>>>            {
>>>>
>>>>            }
>>>>        }
>>>>        public Class1 klase { get; set; }
>>>>    }
>>>>
>>>> antra forma
>>>> public partial class Form2 : Form
>>>>    {
>>>>        Class1 _klase = new Class1();
>>>>
>>>>        public Form2(Class1 klase)
>>>>        {
>>>>            InitializeComponent();
>>>>            _klase = klase;
>>>>        }
>>>>        private void button1_Click(object sender, EventArgs e)
>>>>        {
>>>>            _klase.vardas = textBox1.Text;        //----->va cia 
>>>> pastringa atseit reikia panaudoto "new" ir t.t.
>>>>            Close();
>>>>        }
>>>>    }
>>>>
>>>> klase
>>>> public class Class1
>>>>    {
>>>>        public string vardas { set; get; }
>>>>    }
>>>>
>>
>>
>> -- 
>> Using Opera's revolutionary email client: http://www.opera.com/mail/ 
>