AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

ComboBox Problem

Ein Thema von ironman139 · begonnen am 1. Nov 2013 · letzter Beitrag vom 1. Nov 2013
Antwort Antwort
ironman139

Registriert seit: 1. Nov 2013
24 Beiträge
 
#1

ComboBox Problem

  Alt 1. Nov 2013, 09:31
Hallo,

Ich hab ein kleines Problem mit Lazarus.

Ich hab in meinem Form1 2 ComboBoxen in welchen Daten gespeichert sind.
Dieses angezeigte Item will ich an ein 2. Form weitergeben.
In dem Form 2 rufe ich die Daten mit " label9.caption:= Form1.Combobox1.text; " ab.
Das Funktioniert soweit auch, nur übernimmts mir da nur die Daten von Form1, die bei der OnCreate Methode eingestellt sind.
Also wenn ich die Combox ändere und dann in Form2 übernehmen will, zeigts mir trotzdem nur das Item an , welches bei OnCreate eingetragen war.


mfg. iron
  Mit Zitat antworten Zitat
Benutzerbild von markus5766h
markus5766h

Registriert seit: 5. Mär 2009
Ort: Hamburg
569 Beiträge
 
Delphi XE8 Professional
 
#2

AW: ComboBox Problem

  Alt 1. Nov 2013, 11:13
Hallo, herzlich willkommen in der DP.

Du musst auf die Änderung der ComboBox reagieren,
hierfür gibt es das Ereignis OnChange der ComboBox.
Alternativ kannst Du auch den Wert über die Items
--> ComboBox1.Items[ItemIndex] abfragen.
if ComboBox1.ItemIndex > -1 then Form2.Label1.Caption := ComboBox1.Items[ComboBox1.ItemIndex];
Markus H.

Geändert von markus5766h ( 1. Nov 2013 um 11:25 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Union
Union

Registriert seit: 18. Mär 2004
Ort: Luxembourg
3.487 Beiträge
 
Delphi 7 Enterprise
 
#3

AW: ComboBox Problem

  Alt 1. Nov 2013, 11:29
Hallo,
In dem Form 2 rufe ich die Daten mit " label9.caption:= Form1.Combobox1.text; " ab.
Zu welchem Zeitpunkt findet denn dieser "Abruf" statt?
Ibi fas ubi proxima merces
sudo /Developer/Library/uninstall-devtools --mode=all
  Mit Zitat antworten Zitat
ironman139

Registriert seit: 1. Nov 2013
24 Beiträge
 
#4

AW: ComboBox Problem

  Alt 1. Nov 2013, 11:37
Der Abruf findet statt, wenn ich einen Button drück.
Dann erscheint das Form2
  Mit Zitat antworten Zitat
Benutzerbild von markus5766h
markus5766h

Registriert seit: 5. Mär 2009
Ort: Hamburg
569 Beiträge
 
Delphi XE8 Professional
 
#5

AW: ComboBox Problem

  Alt 1. Nov 2013, 11:47
. . . dann sollte's doch so gehen
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if not Form2.Visible then Form2.Show;
  if ComboBox1.ItemIndex > -1 then Form2.Label9.Caption := ComboBox1.Items[ComboBox1.ItemIndex];
end;
oder

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if not Form2.Visible then Form2.Show;
  Form2.Label9.Caption := ComboBox1.Text;
end;
Markus H.
  Mit Zitat antworten Zitat
ironman139

Registriert seit: 1. Nov 2013
24 Beiträge
 
#6

AW: ComboBox Problem

  Alt 1. Nov 2013, 12:45
Danke ihr habt mir sehr geholfen
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:11 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz