Autor Beitrag
beshig
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 110
Erhaltene Danke: 1

WIN 2000, WIN XP, WIN 2003, Debian Linux
Delphi 7 Personal, Delphi 2005 Personal
BeitragVerfasst: So 06.11.05 17:29 
Ich habe ein Programm, bei welchem der Nutzer Mitarbeiternummern anklicken kann, oder sie per Hand in eine TComboBox eingeben kann. Ich habe nun aber das Problem, dass ich den Inhalt dieser TComboBox nicht auslesen kann. Bei TListBox habe ich dies mit der "Copy" Funktion gemacht, jedoch funktioniert dieses Prinzip bei mir noch nicht bei der TComboBox. Kann mir bitte jemand weiterhelfen ?

_________________
Was ist ein Moderatorenteam in einem recht bekannten Programmierer-Forum ? Viele Meinungen, eine zählt - Mehr ist ja auch nicht notwendig...
Speed
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

WIN XP
Delphi 2006 Prof.
BeitragVerfasst: So 06.11.05 18:31 
Hey,

probiers mal mit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var Nummer:String;
Begin
//...
Nummer:=ComboBox1.Items[ComboBox1.Itemindex];
//...
End;


Greetz Speed
beshig Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 110
Erhaltene Danke: 1

WIN 2000, WIN XP, WIN 2003, Debian Linux
Delphi 7 Personal, Delphi 2005 Personal
BeitragVerfasst: So 06.11.05 18:53 
Jedoch hätte ich da ja alles ausgelesen. Ich möchte jedoch nur die ersten 4 Zeichen..

_________________
Was ist ein Moderatorenteam in einem recht bekannten Programmierer-Forum ? Viele Meinungen, eine zählt - Mehr ist ja auch nicht notwendig...
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 06.11.05 20:01 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var Name: String;
begin
    Name := Combobox1.Text; //Aktuell im Eingabefeld angezeigter Text
    Name := Copy(Name, 1, 4); //ersten vier Zeichen "kopieren" ;-)
end;


Ob's wirklich 4 Zeichen sind, kriegst Du über Length raus ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.