How To Find Index Of Item In A Stack
May 26, 2009
I am using the stack class to store a collection of lines. <code>Dim myStack As New Stack(Of Line)</code> I want to find out what the index is of one of the lines that are in the collection and I'm not sure how to do this. i tried to use array.indexOf:
[Code]...
View 7 Replies
ADVERTISEMENT
Mar 21, 2010
Do I really have to go through all this just to find out what item has been selected in a ListView?
[Code]...
Isn't there something fundamental like this? Is absolutely everything in VB.NET buried beneath a colossal heap of bureaucracy?
View 13 Replies
Feb 2, 2012
I have a List(of String)Each item in the list has multiple values. i.e.
ItemList As List(Of String)
View 6 Replies
Apr 23, 2012
i am having trouble putting a value in a textbox. Each time a ticket is sold i put the total price in a textbox, each time a ticket is sold for the same concert it increases by adding its self to the total price. It works at the first sale, but after that it breaks down. here is the code
Private Function DisplayMoneyTaken() As Integer
Dim totalMoney As Integer
'open the database connection
[Code].....
View 1 Replies
Mar 11, 2010
I have my .net app running on my home machine, and at one point it threw an exception.Problem is, Windows doesn't tell me what the exception is, just says that it stopped responding and closed it.I want to find the exception and stack trace so I can debug it, since I can't to reproduce the problem inside visual studio.The machine is running Windows 7 x64. I found in the event viewer some minor information:
Problem signature:
P1: server info.exe
P2: 1.4.0.0
[code].....
So based on that I can see there was a null reference. I remember way back when I was on XP, when the application crashed it would show the whole exception stack. Can I find that information somewhere?
View 3 Replies
Feb 12, 2011
I'm having some difficulty with a sorted & grouped listbox in WPF vb.net 3.5 that has an items source bound to an ObservableCollection.
What I want to be able to do is to retrieve a piece of data from the ObservableCollection items source depending on what item in the listbox the user has selected.I've almost got it working but because the listbox is sorted it does not match the index of the items source.
[code]...
As I previously mentioned, because the lstBox is sorted and also grouped the index's don't match up.Does anyone know how I can get the correct information I want from the List Source depending on the selected item in the list box?
View 3 Replies
Jun 25, 2012
I want to find a way to speed up this code.if you look at the condition of If calculated Then in the code below, this is what slowing down the code.While the code provided seem fast with Const initBit = 4 try it with something over 12.
I want to be able to use this code (with calculated param as True) with initBit of 20 or more.
Beware that 20 or more might require a gig or more of ram and/or compiled as x64.
C# code (converted with an online tool from VB.NET):
[Code]...
View 2 Replies
Nov 30, 2011
1.) I have a CheckedListBox, ListBox, Button, and ComboBox on a form. There is two ways users add items to the CheckedListBox listed below.
A.) The user will select one item in the ListBox and click the Button and that selected item is added to the CheckedListBox (see code below).
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.Click
' ensure searched analytes checked listbox always contains (Select All) at the top if analytes exist in the list
If Me.CheckedListBox.Items.Count = 0 Then Me.CheckedListBox.Items.Add("(Select All)", True)
[code]....
View 4 Replies
Mar 18, 2011
How can I get an item of a specified index form listbox in a messagebox without selecting any item in listbox.
View 1 Replies
Aug 7, 2009
I am able to get the index of items added to the BindingList. When I try to get the index if the deleted item I get the error Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Here is my code
Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
For i As Integer = 0 To _assignedSelection.SelectedCount - 1
Dim item As Jurisdiction = CType(_assignedSelection.GetSelectedRow(i), Jurisdiction)
_list.Remove(item)
Next
End Sub
Private Sub list_Change(ByVal sender As Object, ByVal e As ListChangedEventArgs) Handles _list.ListChanged
[Code]...
View 2 Replies
Mar 28, 2011
i am trying to find a way to add something to one of the columns in my listview. The way my code is setup is like this:
While dr.Read()
If dr.IsDBNull(12) Then
objItem = lstMaster.Items.Add("nothing")
[code].....
View 1 Replies
May 15, 2009
Is there any way to get the index of the changed item? I couldn't find any examples.
View 1 Replies
Aug 19, 2010
In simple terms, I want to compare the value of a databound listbox display member with another string. However; I need to convert the listbox databound items to an array first as I may have to do 1,000's of comparisons on this.
I have a databound listbox from a sql server table that populates fine. I'm trying to retrieve the display value of a listbox item without selecting the item. My goal is to compare items in listbox1 with items in listbox2 and if item is in listbox1 matches an item I want to load into Listbox2, then I do not add the item to Listbox2. Listbox 2 is not databound but contents I'm loading come from a datatable.
So, I iterate through the items in listbox2's datatable but as I'm adding the items from the datatable to the listbox2, I check if the item exists in listbox1. The data that is being compared is the Displaymember of Listbox1 and a string value I want to manually load into listbox2.[code]....
View 8 Replies
Mar 10, 2010
I'm having a small hiccup in the following code. Basically what I have going on is a play button that will play the selected item in the listbox and once the button is clicked then the next item in the list is highlighted and waiting. This works exactly like I want it but the only issue is when it gets to the last item in the list it want play it.
Private Sub ButtonPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPlay.Click
If (PlaylistBox1.SelectedIndex + 1) <> PlaylistBox1.Items.Count Then
AxWindowsMediaPlayer1.URL = PlaylistBox1.SelectedItem
[code]....
View 5 Replies
Apr 9, 2010
How do I remove an item from an array at a specified index? This code copy's the index and then adds the indexes until it gets to the one you want to remove, skip it, and try to continue. But I get so many errors. From being out of the bounds of the array, to just being null for some odd reason. [Code]
View 5 Replies
Feb 6, 2012
Is it possible to get the row index of a DataTable so that you can access the previous and next row? For example I have a DataTable that contains two columns ChapterTitle and PageURL. This is for a table of contents of a book. ChapterTitle is the chapter name and PageURL is an HTML page that contains the chapter (chaptername.html). When going into one chapter of the book I want to be able to tell which is the next and previous chapter.
After finding the chapter that I'm currently in how can get the next and previous rows?
ChapterTable.Select("PageURL = '" & PageURL& "'")
View 1 Replies
Apr 15, 2010
This is the code for my array (which is working)
Public numUsers As Integer
Public fNameUsers As String = ("......users.txt")
Public UserRecords As Usersclass() 'note... this line is in a module '
reader = New System.IO.StreamReader(fNameUsers)
numUsers = 0
'Split the array up at each delimiter of "," and add new objects '
Do While reader.Peek <> -1
ReDim Preserve UserRecords(numUsers)
oneline = reader.ReadLine
[Code]...
View 4 Replies
Jan 8, 2012
Whenever I try to find an index in a listbox, i get the answer as -1.here's my code.
[code]...
View 8 Replies
Jan 31, 2011
How do i return the column index of an item within a WPF Datagrid, when I click on a cell I'm using Visual Studio 2010/VB.Net?
View 1 Replies
Apr 19, 2011
I want to perform some simple auto-formatting to the cells in my GridView. So far, I have the following code:
Private Sub gridviewRefreshPanel_RowDataBound( _
ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) _
Handles gridviewRefreshPanel.RowDataBound
[Code]...
View 1 Replies
Jun 30, 2010
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
[code]....
View 1 Replies
Jan 31, 2011
I have set my listview multiSelect = false, view = details , FullRow select = true , HideSelected = False. I have one coulumn which has 10 items . I want to get the selected row index in vb.net
View 2 Replies
Feb 6, 2010
I have a combo box setup with 4 items, with indexes ranging from 0 to 3.
Later in my code, I need to do a certain event depending on what is selected. To do this I thought about comparing what the index of the selected combo box item is, because integer comparison is faster than strings, right?
how I can grab the index of the selected value?
View 3 Replies
Sep 8, 2009
How to put a tab index for each item in the radio button list?
View 1 Replies
Dec 27, 2009
If you wanted to remove a listview item, then reinsert it at the same index it already was. Is this possible?
Because all i know how to is reinsert an item at the top.[code]...
View 5 Replies
Apr 20, 2010
I want to return a value of a ListBox item, NOT the index number.
My attempt: Dim pInt1 As Integer = ListBox2.Items.Item(0)
i want this code to return the ListBox item's integer value, and not the index number itself how can i return a ListBox item's value?
View 2 Replies
Jan 30, 2011
what im trying to do is loop threw all listbox items until the listbox item contains say "panda" and stop and give me the index of the item that contains "panda"so i would end up with panda`s selected index
View 6 Replies
Mar 16, 2011
if i have a multidimensional array:
dim test(,,) as string
how can i loop through the array to find if another variable is contained in the second dimension of the array
dim x as integer = test.indexof(OtherVariable)
obviously above won't work
View 4 Replies
Jun 7, 2010
I have an List(of String), i need to find the index of a particular string in that list. I have searched msdn , but i am confused over the predicate methods. I have never used predicates. This i what i have tried
vb
'on button1 click
Dim Heads As List(Of String) = Me.GetSelectedNodes()
Dim tmp As Integer
[Code].....
View 1 Replies
Aug 11, 2010
How should i find the index of the value member in an combobox?
View 4 Replies