Autor Beitrag
der_hugo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26

XP
Delphi 2005 PE, VS 2008 C#
BeitragVerfasst: Do 20.11.08 16:47 
Hallo,

Ich habe zwei Formen:
1. Form: Enthält einen Button. Beim Klicken darauf, passiert folgendes:

ausblenden C#-Quelltext
1:
2:
3:
Form2 f = new Form2();
f.label1.Text = "lk"//geht nicht!
f.Show();


2. Form: Enthält ein Label namens label1.

Also, meine Frage: Wie kann ich nun von Form1 auf die Felder von Form2 zugreifen?
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 20.11.08 17:07 
Das solltest du niemals tun, jedes Formular sollte nur auf seine eigenen Controls zugreifen.
Für die Übergabe von Werten benutzt man Eigenschaften (Properties). Eine paar gute weiterführende Links dazu findest du unter www.mycsharp.de/wbb2...ad.php?threadid=5960.
der_hugo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26

XP
Delphi 2005 PE, VS 2008 C#
BeitragVerfasst: Do 20.11.08 17:15 
Das war´s, was ich gesucht habe!!! :D

Danke!