![]() |
String - TString
Hallo,
habe das Problem, dass ich nicht weiß, wie ich das beheben kann. ich deklariere ne Variable als string hier mal ein Code-Ausschnitt:
Delphi-Quellcode:
da meldet er:
ii := form4.Table1['EintragsNr'];
form4.Table1.First; i:=0; while i <> ii do iii:= form4.table1['Datum']; [color=red]DBComboBox1.items:= DBComboBox1.items + iii;[/color] i:=i+1; Incompatible types: 'String' and 'TString' Danke für Hilfe Stefan |
Re: String - TString
iii wird wohl ein String sein, DBComboBox1.items ist vom Typ TStrings. Die kann man nicht so verknüpfen.
Wenn du der Stringliste den String iii hinzufügen willst, musst du die Methode Add von TStrings benutzen. |
Re: String - TString
und wie mache ich das?
sorry, bin leider in diesem Gebiet ein Vollnewbie :oops: |
Re: String - TString
Wie Chewie sagte:
Nimm die Methode Add von TStrings, z.b:
Delphi-Quellcode:
DBComboBox1.items.Add('diesundjenes');
|
Re: String - TString
Hi!
Mit der Methode Add:
Delphi-Quellcode:
Ciao fkerber
DBCombobox1.Items.Add(iii);
:oops: Zu langsam .... |
Re: String - TString
danke, aber dann kriege ich als neue Meldung:
Incompatible types: 'TString' and 'Integer' |
Re: String - TString
Hi!
Dann ist iii wohl kein String. Dann musst du vorher noch
Delphi-Quellcode:
machen und dann eben iiii adden.
iiii:=inttostr(iii);
Ciao fkerber |
Re: String - TString
IntToStr(iii);
|
Re: String - TString
Was für einen Typ hat iii denn?
Wenn es ein Integer ist, dann schreib halt
Delphi-Quellcode:
DBCombobox1.Items.Add(IntToStr(iii));
|
Re: String - TString
Hi!
Oder einfach:
Delphi-Quellcode:
Ciao fkerber
DBCombobox1.Items.Add(inttostr(iii));
:oops: gott bin ich langsam |
Re: String - TString
hm iii ist zu 100% ein String
Delphi-Quellcode:
private
iii: string; public { Public declarations } end; |
Re: String - TString
Zitat:
geht nicht dann schreibt er nähmlich, dass es keine Methode gibt, die dies erlauben würde |
Re: String - TString
Hi!
Also wenn iii ein Integer ist geht das und sonst dürfte er nicht schreiben, dass es inkompatible Typen sind. Kannst ja mal das Projekt anhängen. Ciao fkerber |
Re: String - TString
so habe mal mit absicht gesagt, dass iii integer ist
Meldung ohne Umwandlung: incompatible types: 'integer' and 'string' Meldung mit Umwandlung: incompatible types: 'tstring' and 'string' wenn iii String ist Meldung ohne Umwandlung: incompatible types: 'tstring' and 'string' Meldung mit Umwandlung: there is no overloaded version of 'IntToStr' that can be called with these arguments |
Re: String - TString
Zeig doch nochmal deine komplette Codestelle dort, oder häng die Unit mal an, wie fkerber schon sagte.
|
Re: String - TString
Liste der Anhänge anzeigen (Anzahl: 1)
danke
|
Re: String - TString
Schon ist klar wo der Fehler liegt:
Es darf nicht heißen DBComboBox1.items:= DBComboBox1.items.add(inttostr(iii)); sondern nur DBComboBox1.items.add(inttostr(iii)); Außerdem denke ich, muss der Inhalt deiner While-Schleife noch in ein Begin und End, so z.B.
Delphi-Quellcode:
while i <> ii do
begin iii:= form4.table1['Datum']; DBComboBox1.items:= DBComboBox1.items.add(inttostr(iii)); i:=i+1; end; |
Re: String - TString
HI!
Nur zu Klarheit: Die Schleife muss so aussehen:
Delphi-Quellcode:
while i <> ii do
begin iii:= form4.table1['Datum']; DBComboBox1.items.add(inttostr(iii)); i:=i+1; end; Da war der Fehler ja noch immer drin @Benedikt. Ciao fkerber |
Re: String - TString
danke jetzt klappts. :-D
|
Re: String - TString
Mist,
erst schreib ich wie es richtig sein soll, und dann in der Schleife vergess ich es zu ändern :wall: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz