removing Listbox item from checked Listview item.The code I tried just errors out.
Private Sub ListView1_ItemCheck(sender As Object, e As System.Windows.Forms.ItemCheckEventArgs) Handles ListView1.ItemCheck If (e.CurrentValue = CheckState.Unchecked) Then ListBox1.Items.Add(Me.ListView1.Items(e.Index).Text) ElseIf (e.CurrentValue = CheckState.Checked) Then
I am using a collection to store data from a text file which I am letting the user load and I am using the .split to split and sort the data into alphabetical order and remove repeating words.However, I am having a problem removing unwanted characters from the final array. For Example, "This is the text file that I want sorted. It is random text not yet sorted"
I have a ListView in my project that has dynamically added/edited/deleted items. When the user deletes an item, I want the item that replaces the deleted item to be highlighted. I tried simply storing the deleted item's index then highlighting the item there (list.Items(index).Selected = True). This works well unless the item deleted was the last item in the ListView (both literally and sequentially). I'm having issues today with logic and can't quite come up with code that checks for these kinds of cases.
I'm trying to remove an item from a TimeSpan list but I need a TimeSpan for the index? If I use a List(Of String) it works fine if I use an integer for the index, but if I use List(Of TimeSpan) it wants a TimeSpan for the index. I have declared a variable like so:
vb Dim TempTime, TimeRemover As List(Of TimeSpan)
but when I try to remove an item from the timespan it says it needs a Timespan and not an integer. Say I have:
vb For x = 0 To 3TempTime.Remove(x)Next
That doesn't work, but if I have:
vb For x = 0 To 3TempTime.Remove(TimeRemover)Next
It will work How can I just remove an item from a TimeSpan list?
EDIT: Figured it out, RemoveAt was what I was looking for.
I have a button that when pressed I want it to remove all the ending urls that have ending with / just to remove / item on the end so it will live me a url with out / on the end if u know what I mean. [Code]
Im trying to remove a certain bit of text from my listbox item..
heres my code..
If ListBox1.Text.Contains(".zip") Then ListBox1.Text = ListBox1.Text.Remove(".zip") End If
and when i start it and it tries to remove it, it comes up with an error saying
Conversion from string ".zip" to type 'Integer' is not valid. ive tried, this code.. If ListBox1.Text.Contains(".zip") Then ListBox1.Text.Remove(".zip") End If
Basically, the user can type in a name and a job description into two different txt boxes and then click add. It then adds the name to the listbox and stores it in a string list (Public strList As New List(Of String)) it also stores the job description in a string list as well (Public strListDescription As New List(Of String))Then when you select an item in the list box it knows what data to bring up in the txt boxes using an array with these lists:
Code: Private Sub lstMyCourt_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstMyCourt.SelectedIndexChanged Dim i As Integer
I'm having trouble removing both the number of adult golfers and children golfers in a group. I want to remove the item as well as update the order subtotal.
The Minigolf form code
Dim intTotalGolfers As Integer = 0 If IsNumeric(txtNumberOfAdults.Text) Then If CInt(txtNumberOfAdults.Text) >= 0 Then
I have a form with a ListView box and a button. When the user clicks on the button, the following code adds an item and subitem to the ListView box. The ListView box has 2 columns (Name and Gold).
Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click Dim testName As String = "Slasher"
I have created collection and adding values in the collection, later I need to find if uer passed value is exist in the collection or not, I use contains finction to find the answer but it always returns false even though user passed value exist in the collection list. here is my code:
However, only the first phone number (Office) displays in the listbox. The phoneinfo collection has both <phone> elements, but the For Each statement doesn't seem to iterate thru.
I'm building a WP7 (VB.NET) app and have a custom class, PinInfo, of which I have two ObservableCollections, TempPins and FavoritePins.
In various parts of the app, I need a unique identifier to get a reference to a particular PinInfo in the collection, so at present, I assign an ID to the PinInfo when it's added to the collection, then later get a reference to the pin via the ID.
For example, if I create a button to delete a pin, I set its tag to the pin's ID, then the button click handler reads the button's tag to get the corresponding pin from the collection (via LINQ).
I generate the ID by adding one to the last-assigned ID, but these lists are often modified (i.e. items removed), so I end up with needlessly large ID numbers (e.g. just a few items, with IDs in the thousands).
In a list of timers, how do I determine the index of the item that elapsed without having to iterate the collection as shown below (e.g. can I pass a paramater to OnTimedEvent, or can the collection raise an event to say which item fired???). It's the individual timer index that I need as I'm using it to refer to something else.
(I wont know how many items I'll have in the list in advance so I can't create an individual event handler for each timer - I don't think I should even if I did).
Public Class Form1 Private _timers As New List(Of System.Timers.Timer) Private Sub Form3_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Can I use LINQ to return an item in a collection that is the same TYPE as the items in the collection? I am a LINQ Noob trying to avoid looping.
Dim mostRecentlyCreatedQuestionnaire As ParentQuestionnaireItem = CType((From P In questionnaireCollection Order By P.Metadata.CreateDate Descending).Take(1), ParentQuestionnaireItem)
I get an "unable to CAST" error when I include the CTYPE function. I kind of expected that error, but I imagine that if I coul dnot do this, LINQ's usefulness would be diminished and therefore assume that there must be a way..
How can I have it so that you can add items to a System.Collections.Specialized.String Collection but only if it is not there already? I have already found the code, but deleted it and cannot remember it. It is something like[code]....
I am creating a simple website using the language of VB.NET, I am having trouble with one part at the moment and could really use some help.
At the moment I have items that are stored in a database, when the homepage loads these items are added to a Gridview which allows the user to select the items they wish to add to their shopping cart. Once an item is selected from the gridview it is added to a collection. That collection is then added to a Session. This is the code I have for completing that task.[code]...
I want to create a very simple database. form1 - ListBox1, textBox1, buttonadd, buttonremove. The item collection of the ListBox1 is stored in a txt file along with a string that will be displayed in the textbox1. the file will look like this ( like a .ini file):
I am doing this within a thread:For Each item As ListViewItem In lvUsers.Items and I am getting: Cross-thread operation not valid: Control 'lvUsers' accessed from a thread other than the thread it was created on.I have been able to adjust a control in a way using something like:
Public Delegate Sub ListAddNameInvoker(ByVal text As String) Public Sub ListAddName(ByVal text As String) If lvUsers.InvokeRequired Then
[code]....
But how do I get data from a control and pass it to another thread?