Autor Beitrag
MOEDI
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Sa 28.10.06 21:34 
N'abend.
Ich hab (mal wieder) ein Problem.
Wenn ich aus einer Combobox den ausgewählten Text der Combobox in ein Editfeld laden möchte und danach dem
Editfeld noch zusätzlichen Text hinzufüge,
(per Edit1.Text:=Combobox1.Items.Text+'xyz')
dann schreibt er in das Editfeld nicht wie gewünscht:
'*AUSGEWÄHLTES ELEMENT*xyz', sondern
'*AUSGEWÄHLTES ELEMENT||*xyz' - sprich, er fügt den Zeilenumbruch des Comboboxitems
mit ein. Wie kann ich das vermeiden?
(Bitte entschuldigt die debütantische Ausdrucksweise :) )
Schönen Abend noch

MOEDI
MarkusBauer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP Pro
Delphi 7 PE+Indy
BeitragVerfasst: Sa 28.10.06 21:39 
Ich erinnere mich da an eine Eigenschaft Caption (oder text, bin mir nicht sicher), die den Text ohne Zeilenumbruch herausgibt. Ansonsten hilft nur Herausfiltern der Zeichen #13 und #10, die für den Zeichenumbruch verantwortlich sind.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Sa 28.10.06 21:42 
Moin!

Du mußt ComboBox1.Text nehmen, statt ComboBox1.Items.Text (was alle Items als String liefert, statt das ausgewählte). ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
MOEDI Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Sa 28.10.06 21:42 
Das mit dem Herausfiltern von #10 bzw. #13 hab ich schon probiert.
-Leider ohne Erfolg.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Sa 28.10.06 21:42 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Edit1.Text:=StripLB(Combobox1.Items.Text)+'xyz';

function StripLB( str: string):String;
var
    s: string;
begin
    s := str;
    if str[ Length( str)-2) = #13 then setLength( s, Length(s) -2);
    result := s;
end;

_________________
Markus Kinzler.
MOEDI Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Sa 28.10.06 21:45 
Danke.
Ich werds einfach mal ausprobieren gehen. Schönen abend noch
MOEDI