| View previous topic :: View next topic |
| Author |
Message |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Wed Dec 12, 2007 7:56 pm Post subject: [Delphi] Check for String in ItemBox |
|
|
Well hello,
I'm wondering if there is a way to check like
| Code: | | if 'lol' is on Memo1.Lines = true then ShowMessage('It's on the list') else ShowMessage('It's not on the list') |
Or if it's on a ItemBox/Listbox.
Is this possible ?
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Wed Dec 12, 2007 8:05 pm Post subject: |
|
|
im not sure but i think it was something like:
i : integer;
for i := 1
if listbox1.selected[i] = '/string'
then begin
end;
im pretty sure it's like that or somewhere near that
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Wed Dec 12, 2007 8:21 pm Post subject: |
|
|
Mhh can't get it to work Thanks anyway.
|
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Wed Dec 12, 2007 8:21 pm Post subject: |
|
|
I'm not really sure but it has to do with checking each entry individually.
Btw, there is no component called 'ItemBox.' Are you talking about ListBox or ComboBox?
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Wed Dec 12, 2007 8:23 pm Post subject: |
|
|
Yes I mean ListBox sorry.
But how will you check each entry ?
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Wed Dec 12, 2007 11:20 pm Post subject: |
|
|
| Code: | For I :=0 to listbox1.Items.Count -1 do
If listbox1.Items[i] = 'MyString' then
showmessage('OMG! MY STRING IS IN IT'); |
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Thu Dec 13, 2007 4:19 am Post subject: |
|
|
Wow thx hehe cookie for you
But how can I do the same with a TEdit box?
Like Edit.Text is 'I are cool'
if Edit1.Text = *'are'* then.... // the * as placeholder
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Thu Dec 13, 2007 8:47 am Post subject: |
|
|
You can use the Pos function:
| Code: | if Pos('are',Edit1.Text)> 0 then
showmessage('Blah!'); |
And about my previous code, its check if the hole line is like the string.
If you want to know if the line contain your string use this code:
| Code: | For I :=0 to listbox1.Items.Count -1 do
if Pos('are',listbox1.Items[i])> 0 then
showmessage('Blah!'); |
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Thu Dec 13, 2007 12:36 pm Post subject: |
|
|
| what was so hard about it.. ?
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Thu Dec 13, 2007 6:55 pm Post subject: |
|
|
| Kaspersky wrote: | | what was so hard about it.. ? |
I never said it's hard, I just said I've no idea how to do something like this.
And wanna know something? YA? so: I'm really sure you didn't know it as well.
Don't show off with skills which you don't got!
|
|
| Back to top |
|
 |
jongwee Moderator
Reputation: 0
Joined: 28 Jun 2006 Posts: 1388 Location: Singapore
|
Posted: Thu Dec 13, 2007 6:58 pm Post subject: |
|
|
Kasper don't be an ass..
_________________
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Fri Dec 14, 2007 6:01 am Post subject: |
|
|
| jongwee wrote: | | Kasper don't be an ass.. | Ya, he just learning...
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Fri Dec 14, 2007 6:10 am Post subject: |
|
|
| HolyBlah wrote: | | jongwee wrote: | | Kasper don't be an ass.. | Ya, he just learning... |
This is basic shit
|
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Fri Dec 14, 2007 6:12 am Post subject: |
|
|
| He need to learn somewhere...
|
|
| Back to top |
|
 |
ups2000ups I post too much
Reputation: 0
Joined: 31 Jul 2006 Posts: 2471
|
Posted: Fri Dec 14, 2007 6:43 am Post subject: |
|
|
isent it basic programing to know how to get strings from listbox and stuff?
_________________
dont complain about my english...
1*1 = 2? |
|
| Back to top |
|
 |
|