Find & Remove From List??
Nov 4, 2009
I have a simple class called Player. I can add players to it, but haven't figured out how to remove them. I've tried various ways, some compile some don't none work
Public Class Player
Public Name As String
Public Sub New(ByVal name As String)
[code].....
View 8 Replies
ADVERTISEMENT
May 20, 2012
I'm having issues with finding something in list, and removing the item, ignoring the case of characters in string.
The code goes:
Dim listItems As New List(Of String)
Dim pattern As String = "AbC"
Dim array() As String
array = {"ABC", "abc"}
listItems.AddRange(array)
Here I'd like to remove all items from listItems, that are abc, no matter what case single characters of item are, including mixed case items. So in this example, every items should be removed
listItems.Remove(listItems.Find(Function(r) r = pattern))
If I change pattern to match the case of item, then item #2 gets removed:
pattern = "abc"
listItems.Remove(listItems.Find(Function(r) r = pattern))
How can I find item in listItems, ignoring the case characters in pattern?
View 7 Replies
Dec 16, 2011
I am trying to be able to find a delete a specific String.
If nameList1.Text.IndexOf(TextBox1.Text) Then
nameList1.Text = nameList1.Text + nameList1.Text.Remove(start, theEnd)
End If
I have start and end set to a value the user inputs
View 1 Replies
May 2, 2012
i am writing a program that reads a excel report from accounting software with our weeks orders on... so basically the program reads a list of around 100 items which all works fine.I also have a database that holds info on each item, when the excel sheet is parsed the software checks to see if any new items have been added to the list that are not on the softwares database. this is where i am having the issue.I have two lists: ItemsOrdered & ExistsingItems.
All the items ordered this week are in ItemsOrdered and all the items not in the items in the database are in the ExistsingItems list. using these two lists how can i find items that are in ItemsOrdered but not in ExistsingItems.
View 2 Replies
Apr 15, 2012
Dim data as string = http://profile.ak.fbcdn.net/hprofile-ak-snc4/161116_00000000000000_375500185_q.jpg
data is can variable [URL]I want the just get bold text, and remove italic All text's can variable?
View 1 Replies
Aug 22, 2010
I need to go line by line through a text file as well as a listbox and remove lines over x amount of characters as well as adding the number of skipped lines to a label. I am trying to use a listbox in this example but it is not working correctly. What I am I doing wrong? First it will only remove an item when it is highlighted (focused) how can I make it so that is not required?[code]...
View 7 Replies
Aug 10, 2010
im trying to find a specific text in a textbox and remove it . i don't figure a way to do it .
If richtextbox1.text.contains(listbox1.selecteditem) then
' there i dont know how delete the text !!
end if
View 1 Replies
May 13, 2011
I have a List which gets a Check Class like below:
[Code]...
View 4 Replies
Jun 9, 2011
I have a listbox in my program and I want the user to be able to remove all Listbox Items with the click of a button.
I Figured this would work, Listbox1.Text = ""
View 3 Replies
Aug 16, 2009
I have a BindingList (of Class) list that is the source for a datagridview and I'm trying to figure out how to remove a selected line from the list.[code]...
View 2 Replies
Feb 23, 2010
I fail to remove duplicates from my List. What am I doing wrong?
Dim Contacts As New List(Of Person)
...
' remove duplicates '
[code].....
View 2 Replies
Feb 6, 2010
I have a List of a custom class (barData) that I need to remove elements form based on a date.
The bardata class holds data of stock price information.[cod]e...
Is there a way to do it without looping through each bar as I may have 2000 plus bars for each stock and may have 2000+ plus stocks to look at. It can be done by looping but it is slow.
View 2 Replies
Jan 18, 2010
I need a piece of code which will remove a highlighted item from a listbox.
View 3 Replies
Mar 10, 2012
i am making a card game and you get three cards in your hand at a time, i am using a list and random assigning to set the cards in my hand as different numbers but they keep being all the same numbers, here is what i have, what should i add to make it be a different number for every one
Dim hand1 As Integer
Dim hand2 As Integer
Dim hand3 As Integer
[Code]....
View 3 Replies
Sep 3, 2009
After reading all the examples for list of T exists and Find and find first, none show how to handle multi-property objects. Below is bare bones example maybe someone could flesh out to show how this should be done.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DatePriceList As New List(Of DateAndPrice)
DatePriceList.Add(New DateAndPrice(Date.Parse("1/1/2000"), 10.12))
DatePriceList.Add(New DateAndPrice(Date.Parse("1/2/2000"), 11.12))
[Code]...
View 3 Replies
Apr 1, 2008
Got a form linked to a database and i have the first column of data appearing in a list box on my form. In the database there are two records with the same value and so, of course, in my list box the value is given twice.How do i remove this repetition from the list box? (still keeping it the same in the database)
View 5 Replies
Sep 29, 2010
learning about loops (still a beginner) in VB.net. I have got the below code and basically it is meant to stop the loop once it reaches a number above 20. Now, the problem is that it does stop after number 20 but the last number that is displayed in the list is always above 20..... how I can stop it showing the last number as above 20?
[Code]...
View 6 Replies
Jun 23, 2012
I am creating a program which can store files, and I display their names in a list box, with their contents in another list box. My program can read the file names but has the file extension ".txt" added to all of them, meaning that the program cannot read the contents. How can I remove ".txt" from them? [code]
View 3 Replies
Aug 12, 2010
Good example using the List(T) object. I need to be able to add and remove items from it.
View 7 Replies
Jan 28, 2010
I use this function to remove items in a listbox that I add programatically.. using the item.add.But i need a value with it so switching to databound ListBox. How can I remove an item or add an item without getting an error that "Items collection cannot be modified on a databound object"[code]...
View 2 Replies
Mar 11, 2010
So I've got a list of strings in ListBox1 and I want to remove the last seven characters from each string in the list and write the output to an excel file...
View 3 Replies
May 25, 2010
How do i remove a selected item(s) from a list box called "LeftList" and add it to a second list box called "RightList"
[code]...
View 10 Replies
Jun 30, 2009
How can I find words like and, or, to, a, no, with, for etc. in a sentence using VB.NET and remove them. Also where can I find all words list like above.
View 4 Replies
Jan 19, 2010
This is my problem, i have created a series of lists of stock items, i now need to remove items in one of the lists that exist in another list. simple enough except the quantity of stock is not necessarily the same so removing an object of the type stock wont work as they are not identical (stock amount not the same) any ideas on how to remove this item from my list?
View 8 Replies
May 10, 2012
How would you remove an the last item of the list (of strings) when you don't know the index of the last item and it varies every time you run the program? Would I be better off using an array instead?
View 2 Replies
Oct 25, 2009
In C++ using std::list, this is a simple matter of erasing what an iterator is pointing to (the erase statement returns the next valid member of the list).What's the best way to iterator through a list and remove members that match a certain criteria?
View 4 Replies
Jul 7, 2011
I have a couple of dropdown lists like this
<asp:DropDownList runat="server" OnSelectedIndexChanged="Update_ddls" AutoPostBack="true" ID="ddl1" />
<asp:DropDownList runat="server" ID="ddl2" />
[Code]...
I also have a function called Update_ddls which runs OnSelectedIndexChanged that looks like this
ddl2.Items.Remove(ddl2.Items.FindByValue(ddl1.SelectedValue.ToString()))
Which removes the selected item in ddl1 from the second dropdown but if I keep changing the ddl1 item then ddl2 won't have any items left in it.
Is there a way to re-add the previously deleted items in the Update_dlls function without re-databinding because if I re-databind I lose the selected item in the ddl?
View 2 Replies
Sep 14, 2011
Is there a simple way to remove Objects from a List by using a specified value?I add 2 persons to a List, how can now I remove a person by a name without using any Loops? (if possible)
[Code]...
View 3 Replies
Apr 26, 2011
In Window Form ListView, I add columns dynamically, but I got an extra column. How to remove it? Which property can it be set?
View 1 Replies
Jul 28, 2010
Public Class GroupSelect
Public Property RowNo() As Integer
Get
[Code]....
View 1 Replies