|
-
Apr 4th, 2008, 12:54 AM
#1
Thread Starter
Lively Member
[2005] Another small quick question
Just a quick thing, Code below is checking collision with tags:
vb Code:
If TypeOf Wall Is PictureBox AndAlso Wall.Tag = "Item Fireball" Then
If Wall.Bounds.IntersectsWith(Pic1.Bounds) Then
Me.Controls.Remove(Wall)
End If
End If
how do i do it so it detects the tag of "Item Fireball" as something like "Item *" as i will have multiple items, each having a tag starting with the word "Item".
Last edited by squrrilslayer; Apr 4th, 2008 at 06:29 AM.
-
Apr 4th, 2008, 01:07 AM
#2
Re: [2005] Another small quick question
Please provide descriptive titles for your threads in future.
vb.net Code:
If CStr(Wall.Tag).StartsWith("Item ") Then
VB also has a LIKE operator that you can use to make wildcard comparisons:
vb.net Code:
If CStr(Wall.Tag) Like "Item *" Then
-
Apr 4th, 2008, 01:08 AM
#3
Thread Starter
Lively Member
Re: [2005] Another small quick question
ok. and what if the string i want to detect is somewhere in the middle?
-
Apr 4th, 2008, 01:10 AM
#4
Re: [2005] Another small quick question
I edited my previous post to use the Like operator, which can be used to answer you most recent question. Note that the String class also has a Contains method that would do the job.
-
Apr 4th, 2008, 01:26 AM
#5
Thread Starter
Lively Member
Re: [2005] Another small quick question
ok thanks alot!
-
Apr 4th, 2008, 01:47 AM
#6
Frenzied Member
Re: [2005] Another small quick question
Read my signature (the resolve part)
And I can't believe I've never seen that before!!! Thats "Like" crazy
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|