Autor Beitrag
kronoide
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 18:13 
Hallo Leute :wave:

ich wollte fragen ob man die listbox nach strings prüfen lassen kann und
wenn sie vorhanden sind dann soll er etwas ausführen

danke schon mal :wink:
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 25.01.07 18:18 
Moin!

Du Suche hilft: Suche in: Delphi-Forum, Delphi-Library LISTBOX DOPPELT ;)

cu
Narses

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



BeitragVerfasst: Do 25.01.07 18:22 
sollte wohl öfter die suche nutzen :rofl:
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 18:40 
also ich habe jetzt diesen quelltext:

for i := 0 to listbox1.items.count do
if (listbox1.items[i] = 'hi') and (edit1.Text = 'hi') then edit1.Text := 'funktioniert';

aber wenn ich es kompiliere dann gibt er mir eine fehlermeldung wieder :cry:

kann mir jemand helfen?
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 25.01.07 18:41 
und die wäre? :roll:

Auf jeden fall muss die Schleife bis count - 1 laufen und nicht bis count. :wink:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 18:46 
error --> listindex out of bounds (0)
ich habe denn fehler mit count korrigiert aber dann kommt: listindex out of bounds (-1) :nixweiss:
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 25.01.07 18:47 
Sind überhaupt items vorhanden?

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 18:50 
ja es sind welche vorhanden...
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 18:54 
hat irgendjemand eine idee :?:
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 25.01.07 18:57 
Zeig mal deinen Code.

Nach 4 mins Schiebeposting is schon unverschämt.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 19:05 
sorry wollte nicht unverschämt sein :oops:
ausblenden Delphi-Quelltext
1:
2:
for i := 0 to listbox1.items.count do 
if (listbox1.items[i] = 'hi') and (edit1.Text = 'hi') then edit1.Text := 'funktioniert';
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 25.01.07 19:07 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var
  i : Integer;
begin
  i:=ListBox1.Items.IndexOf(edit1.Text);
  if i=-1 then
  Edit1.Text:='Nicht Vorhanden'
  else
  Edit1.Text:='Vorhanden'
end;
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Do 25.01.07 19:07 
Ich dachte du hast jetzt count -1 da stehn?
Warum fragst du nicht ab If ListBox1.items.Strings[i]=Edit1.Text Then ...
Also mach auf jeden fall mit ListBox1.Items.Strings[i]

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 19:12 
so habe ich es nicht gemeint ich weiß wie man prüft ob ein edit.text in listbox vorhanden ist
ich möchte, dass wenn in edit1.text und listbox1 'hi' steht er in edit1.text '//irgendwas' ausgibt

so habe ich es gemeint :lol:
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 25.01.07 19:21 
Na wenn Du das alles weisst, wo liegt denn das Problem.
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 19:23 
das problem ist mein quelltext :rofl:
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Do 25.01.07 19:31 
ausblenden Delphi-Quelltext
1:
2:
for i := 0 to listbox1.items.count-1 do
 if (listbox1.items[i] = 'hi') and (edit1.Text = 'hi') then edit1.Text := 'funktioniert';


Also das funktioniert auf jeden Fall auch, dann musst Du woanders noch einen Fehler haben.

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
kronoide Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 25.01.07 19:34 
achso :oops:
das war logisch :wink:

vielen DANK :D