KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Suggestion: Contains property

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Wed Apr 18, 2007 2:07 pm    Post subject: Suggestion: Contains property Reply with quote

I'd like to take this opportunity to ask for the Contains propery for the items property in ListBoxes, ComboBoxes etc. It is an existing .net property. Just not sure if it was introduced in .net 1.1 or 2.0.....

It really comes in handy:
Code:

If $ListBox1.Items.Contains("something")
  $ListBox2.Items.Add("something")
EndIf

Just an example...

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Apr 18, 2007 2:33 pm    Post subject: Reply with quote

Will look into this today ...
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Apr 18, 2007 2:37 pm    Post subject: Reply with quote

It is in version 1 - but it doesn't work quite like you posted. The parameter provided isn't a string - you need to provide a ListViewItem object to "check for" .... Kinda dumb in my opinion.

Unless you saw this syntax listed or documented somewhere else - or maybe they changed things later on ...

Still looking into.

Heres the syntax by the way:

Code:

[Visual Basic]
Public Function Contains( _
   ByVal item As ListViewItem _
) As Boolean
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Wed Apr 18, 2007 3:11 pm    Post subject: Reply with quote

btw - when I said "kinda dumb" didn't mean your suggestion was dumb - meant the way ms implemented it was kinda dumb - your suggestion makes more sense.
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Wed Apr 18, 2007 4:37 pm    Post subject: Reply with quote

I'm not sure if 'Contains' needs to be added, it could be acomplished with something like:
Code:

For Each $Item in $ListBox1.Items
  If $Item.Text = "Something"
    $ListBox2.Items.Add("Something")
  EndIf
Next

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Apr 19, 2007 6:41 am    Post subject: Reply with quote

Shawn wrote:
It is in version 1 - but it doesn't work quite like you posted. The parameter provided isn't a string - you need to provide a ListViewItem object to "check for" .... Kinda dumb in my opinion.

Unless you saw this syntax listed or documented somewhere else - or maybe they changed things later on ...

Still looking into.

Heres the syntax by the way:

Code:

[Visual Basic]
Public Function Contains( _
   ByVal item As ListViewItem _
) As Boolean


Actually in VB.Net I used the properties as I explained earlier, as a string value.
Code:

If Not ComboBox1.Items.Contains(ComboBox1.Text) Then ComboBox1.Items.Add(ComboBox1.Text)

At benny: the contains property would speed up code faster then a loop would Smile

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Thu Apr 19, 2007 11:34 am    Post subject: Reply with quote

That is true
_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Apr 19, 2007 12:34 pm    Post subject: Reply with quote

k, I will fire-up visual studio and check it out further.
Back to top
View user's profile Send private message
apronk
KiXforms Regular
KiXforms Regular


Joined: 28 Jun 2006
Posts: 53
Location: The Netherlands

PostPosted: Thu Apr 19, 2007 2:58 pm    Post subject: Reply with quote

Shawn wrote:
k, I will fire-up visual studio and check it out further.


Thats all I needed to read Wink

_________________
Achieve inner peace through outer violence.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group