A List Where An Index Has Three Values Associated With It?
Nov 16, 2011
I have been searching everywhere but I am unable to find a reference to what I need.I have a huge number of entries where each entry is composed of three long numbers:
a b c
1 2 40
2 1 40
1 8 12
3 9 13
8 1 12
ect.
in my algorithm I will find that I need to disregard values in column a which will then lead me to disregard values in column b. I initially thought that I may want to use three arrays and just change the disregarded value to a null value with each iteration. find function that would allow me to not have to loop through the entire array every time.This lead me to want to define the columns as lists where I could remove specific values from the list and reduce the size of the list with each iteration of the algorithm. The problem then is how do I say, listb.remove(8) and at the same time have the corresponding values for lista(1) and listc(12) removed?
View 4 Replies
ADVERTISEMENT
Dec 26, 2011
Basically I have a form which has 2 drop downs. In the 1st drop down I am selecting City category. When the city is selected I want to update the 2nd drop down values in correspondence to 1st value choosen in 1st drop down. I have done like this,This adds the value in the 1st Drop Down:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s As String = "connection String"
sqlconn = New SqlConnection(s)
[code]....
View 2 Replies
Jan 6, 2012
Suppose you have list 1 (ilist1) and list 2 (ilist2) both lists have 3 items.
At index 0 item1 which has text "-- Select --"
At index 1 item2 which has text "Yes"
At index 2 item3 which has text "No"
Both lists have identical items. I would like to know if it is possible to have the selection of list one be "Yes" and the selection of list two be "No" and vice versa using SelectedIndexChanged or something of the sort.
For example:
ilist1 = --Select--
ilist2 = --Select--
[Code]....
View 2 Replies
Jun 29, 2009
This code below is from one of the different forms that I am using for a bigger project. I keep getting an error when it comes to the list box. Each index needs to be assigned a value and I can't get it to work!
Index 0=8
Index 1=15
Index 2=70
Public Class frmRegular
Private Sub btnCloseRegular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCloseRegular.Click
Me.Close()
End Sub
[Code] .....
View 2 Replies
Jun 11, 2012
I'm running into a little problem with a gridview and a dropdownlist. I can get the dropdownlist to load initially, but when it autopostback's it returns with no value. I am populating the dropdownlist in the RowEditing sub. I'm guessing that I must somehow rebind in the RowDataBound sub, but don't know how to go about it. If I try to find the control's SelectedValue I end up with nothing.
VB Code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
[Code].....
View 1 Replies
Dec 22, 2009
I had a form with over 40 command buttons on it. I indexed the buttons: Private Sub Command1_Click(Index As Integer) 'perform this End Sub How can I achieve the same basic thing in .net? What is it called? What to search for?
View 5 Replies
Dec 9, 2010
'Get the selected index of the list box 'use that selectedindex for the row of the array and get both the quantity and price into local variables in VB
[Code]...
View 6 Replies
Dec 6, 2011
I think I'm having a brain fart on this but I can't seem to figure out why this is not working.
Public Class Radio_Main
Dim RadioDial As String = 1
Dim Go As String = "http://"
Private Sub pb_Tuner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pb_Tuner.Click
'My.Computer.Audio.Stop()
[Code]...
View 2 Replies
Mar 23, 2011
Is it possible to (or how can I) assign values to a class property array like this:
MyImgClass.RGB = (255,255,255)
I'm not sure how to build my Public Property setter to allow this, if it's possible at all.
View 4 Replies
May 15, 2009
i'm trying to do a filename compare, sort of fuzzy match.Here's what code i have.First of all i load 2 directory's into 2 listbox's as strings and remove the filepath. Directory1
Code:
TextBox1.Text = FolderBrowserDialog1.SelectedPath
If TextBox1.Text = "" Then
Else
Then when i click the compare button i am trying to pass listbox1 and listbox2 through Distance and return the resulting fuzzy file matches.
Code:
Dim MyObject As New StringSift2
Dim ReturnVal As Single
ReturnVal = MyObject.Distance(ListBox1.SelectedItem, ListBox2.SelectedItem)
[code]....
But i get this error.
Code:
TreeView1.Nodes(lb1).Nodes.Add(ReturnVal.ToString())Specified argument was out of the range of valid values. Parameter name: index
View 3 Replies
Oct 19, 2010
I have a program that calculates values of a function, say f, with respect to another variable, say L.I have an array of f(L), for L going from 0 to a given integer value, say t-1 in steps of a value i.I need to export the values of this function to an Excel spreadsheet in a given column, and to do this, I would like to re-index the function f, since i is much less than one, and so the following loop I use (see below) won't work:
For L = 0 To t - 1 Step i
Sheet.Cells(L, 1) = L
Sheet.Cells(L + 1, 2) = f(L)
Next L
The first code in the loop will essentially load the values of L itself, at which the function is defined and calculated, and the next line will load the values of the function at each value of L.Since the indexes of the row and columns in an excel spreadsheet only go in steps of 1, I need to convert the indexes of the function, or the indexes to which L is loaded, so that it would be scaled so that the first entry corresponds to L=0, but the next is L=i, but loaded into row number 2, etc.
View 1 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 15, 2011
Ive got two lists (each representing a table in a DB, so they are related). lstTransaction has t_id, date, and cust_id. lstCustomer has Name, and cust_id.For each item in lstTransaction Id like to find the index in lstCustomer where lstCustomer.cust_id = lstTransaction.cust_id.
View 5 Replies
Aug 29, 2011
How on specific behaviour can be created in a custom class. I want to be able to create a custom class (a kind of list) where I can access the items by their index (this is the easy part), but also by a string that would describe them. Here is an example:
MyClass(1).SomeProperty = "NewValue"
MyClass("Item1").SomeProperty = "NewValue"
You can see this kind of behaviour in dataset for example where you can select a table by its name or by its index like this :
DataSet.Tables("MyTable").Rows...
DataSet.Tables(1).Rows...
How can I create a custom class that will behave like this?
View 2 Replies
Mar 21, 2012
I am trying to get an index of a List(Of Details) Details being a class i use instead of an annon method. Is it because i am using array.findindex when it's not an array but a list(Of???
Dim index As Integer = Array.FindIndex(Details, Details.FirstOrDefault(Function(nd) nd.Name = "name"))
Error1Data type(s) of the type parameter(s) in method 'Public Shared Function FindIndex(Of T)(array() As T, match As System.Predicate(Of T)) As Integer' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.
View 5 Replies
Oct 17, 2011
I want to build my own class. In it, I need to recreate a behavior we can see in DataTable and in some other places : accessing items by their name or by their index. [code]...
View 5 Replies
Oct 17, 2011
I want to build my own class. In it, I need to recreate a behavior we can see in DataTable and in some other places : accessing items by their name or by their index. How can I reproduce such a behavior. Here's what I mean :
'Here's one way to access the data
A = MyObj(0).value
'Here's the other way I would like to acces it
A = MyObj("Blablabla").value
How can I create my class so I can access items in an array (or list preferably) by it's index or an unique Name?
View 4 Replies
Jul 25, 2010
I would like to create a list of integers. The list will be items that I need to index by a key (string) or an index, which I set. For example I have items 1, 2, and 5. I would like to call Array(5) = 1. Where the the 5 is indexing a particular item 5, not the 5th item in the array. Using Array("5") = 1 could work as well. I tried using a List, but the only index is the ordered element of the list. I tried a Collection, but I kept getting errors that the items of the Collection are read only. How can I do this?
To be more specific, I have a simple game application which has a Player class. Each Player is trying to collect hits of say 3 fields {1,2,5}. I need to store how many times a player hits each of the 3 fields. So, I would like to read and write using logic like player(1).field(5) = 5. I want to add an object to the Player class which stores the number of times each of the 3 fields has been hit.
View 3 Replies
Jan 24, 2011
Using vb.net, is it possible to have a list of values such as:
Green
Black
Blue
and the index to be a text value such as
Table
Desk
Chair
something like this
ListColors("Chair")="Green"
ListColors("Desk")="Blue"
ListColors("Table")="Black"
View 1 Replies
Oct 17, 2011
I want to build my own class. In it, I need to recreate a behavior we can see in DataTable and in some other places : accessing items by their name or by their index. How can I reproduce such a behavior. Here's what I mean :
[Code]....
View 2 Replies
Jun 3, 2010
How to use Generic List Where method based on index if there are mutiple 'similar' values, see example below
View 3 Replies
Sep 13, 2011
[url]...base on the thread ive linked.
i am able to pass the checked value of the checked list box to a list box
my current problem is
i am going to save the values [ for instance mat_name ] on the listbox in the database
but i need the id [ for instance mat_id ] of that value
View 14 Replies
Apr 4, 2011
I had restart my program for 5 times, and i still can get through it. the due date just around the corner.
"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."
View 9 Replies
Apr 25, 2009
I have a VB.NET project where I am able to iterate through the keys and values collections of a dictionary object using an index:
MyDictionary.Keys(idx)
MyDictionary.Values(idx)
When this code is taken from the test project and placed into the real project I get the following error:
'System.Collections.Generic.Dictionary(Of Double, String).KeyCollection' cannot be indexed because it has no default property.[code]...
In the line in sub search that says "dtf.Keys(idx) = 0" place your cursor after the right parenthesis and backspace you should get a tooltip that says, "<Extension> ElementAtOrDefault(index as Integer) as Double - index: the zero based element of the index to retrieve.
View 3 Replies
Jun 1, 2009
I have a gridview with a dropdown list that was created programmatcially. I want to have access to the selected value and to that row's Id. I have the dropdownlist created in *Gridview_RowDataBound* and I am able to use the text in the cell but my addHandler is never fired. Where do I give it the Add handler. I believe I can assign it the addhandler in RowCreated but how would I be able to set up the add handler if the button is created in rowdatabound?
[Code]...
It fits best in Rowdata bound because my dropdownlist items don't duplicate but I need to be able to use the addhandler I created.
View 2 Replies
Oct 13, 2009
doing dropdown list selected index changed. I wan to select an item in dropdown list and display in textbox but I got more than 1 textboxes. Is the style sheet (.css) going to hard code by our own. how do I go about starting with it as I am a beginnner using visual studio.
View 1 Replies
Oct 13, 2011
Say I have a list and I have an object. I want to find the index of that object in the list.
View 1 Replies
Nov 1, 2011
dim ItemNum As Integer = 0
Dim Selecteditem As ListViewItem = ListView1.SelectedItems(ItemNum)
Select Case ItemNum
[CODE]...
keeps telling me that InvalidArgument=Value of '0' is not valid for 'index'.
View 1 Replies
Sep 8, 2009
How to put a tab index for each item in the radio button list?
View 1 Replies
Oct 9, 2009
I have a list view control that users can add items to but I need to be able to tell what item they have selected.
View 2 Replies