Manipulation Of List (Of T) Collection

Sep 9, 2009

I wanted to know if it's possible to remove a paticular item in my collection and then add it back at a certain location? e.g. say I use RemoveAt and remove the first item in the colleciton; after, I want to add it back at a particular location (index)? Maybe this isn't possible with this type or any other type collection?

View 6 Replies


ADVERTISEMENT

C# - Edit List Collection : Error Note Collection Was Modified - Enumeration Operation May Not Execute?

Sep 7, 2011

I have the following classes:

Product, Service and OrderItem

Product and Service must inherit OrderItem. So basically I want to store OrderItem object in my shopping cart and these object are store in a list.

Public MustInherit Class OrderItem
Private m_enuItemType As TypeOfItem = TypeOfItem.None
Private m_strUserID As Integer[code].....

View 1 Replies

VS 2005 - Simple XML Product List Viewer / Manipulation

Aug 30, 2009

I'm trying to create an application that is able to find products from a XML file, which will contain the following data:EAN (Barcode as a string, not an image)
Description
Price
Stock

So basically, I enter the EAN and my program will lookup the XML file for this EAN and will return the description of this product, the price and the stock in a new messagebox. However, I don't understand how to create a XML file, add items, remove items, edit items, and most of all: read items from a XML file.

View 5 Replies

String Manipulation - Input A Very Long List Of Dog Breed Names Into A DB Via Phpmyadmin

Jun 11, 2010

I am trying to input a very long list of dog breed names into a DB via phpmyadmin, this will take me for ever manualy and I was thinking if I could work out how to write something quick and nasty to create the sql string for each dog breed it would save me so much time. The sql query for each added forum is in the following format:

[Code]...

View 4 Replies

Binding To A List Within A Collection WPF/VB

Mar 16, 2012

I was wondering if its possible to bind a datagrid column to a list (Of T) thats stored within an observable collection!

Here's my current code:

Dim _BindWithThis As New List(Of BindWithThis)
Me.DataContext = _BindWithThis
For i = 0 To 3

[Code]....

This currently displays four rows of "(Collection)". Is it possible to step into one of these "Collection" rows and display the data? I know that this is possible to do with a list box by binding with a specific element in the collection:

ListBox1.ItemsSource = _BindWithThis.Item(0).DataValue

I just can't work out how to do this with a datagrid...

View 2 Replies

Get List Or Collection Of ToolTip?

Dec 21, 2011

I can not find the collection on toolTips (I need to do this dynamically across forms).

vb
For Each theToolTip As ToolTip In getControls(theForm)
Next

error :Error 12 Value of type 'System.Windows.Forms.Control' cannot be converted to 'System.Windows.Forms.ToolTip'. C:UsersJeffDocumentsJeffWorkSpace2StudyX.NETModule1.vb 3690 51 study

View 5 Replies

Populate A List Collection Using Methods?

Jan 10, 2012

If I run my web service code, it generates a serialized XML with only one level, that is,ParentElement and ChildElement. My goal is to make it a multiple XML levels that even grandChild will show, as the sample output below. How can I achieve this using List ollection looping. Do I need to create several functions that returns List objects for each column of the dataset I have?

public List<MyClassEntity> ExtractEmployee(...params here...)
{
...SQL CONNECTION HERE AND SP TO RUN THE QUERY...

[code].....

View 2 Replies

Printing A File From List Collection?

Nov 16, 2009

I have a program in which I display a list of files in a ListView control and then send them all to a printer. I verified that the file is getting from the list to the print routine;however, I cannot seem to get the print function working right. I have tried several methods after reading many forum posts and articles to no avail. I listed my print routine below for reference; I send the file to the ReadFile sub that programatically creates the Print Document and then calls the Print page event. All in all rather simple, but I keep gettting about a dozen lines of blocks and arbitrary characters and then my document starts printing. I thought that by defining the SizeF structure in the MeasureString method and the RectangleF in the DrawString method I would clear up the problems

Private Sub ReadFile(ByVal _pfile As String)
Try
'Dim fs As FileStream

[code].....

View 8 Replies

Raise Event Through List(Of Collection)

Jan 23, 2010

I'm not to sure if this is possible this way but I'll try to example what I'm trying to do, I want to raise an event from a class but the class is in a List(Of Collection) for example

A - I have a usercontrol
B - That has Groups
C - The groups have children

The control would be similar to listview/Treeview

Below is the cutdown versions of my classes

Code:
Public Class InfoChildren
Private mText As String
Public Event TextChanged(ByVal Sender As Object, ByVal e As TextChangedEventArgs)

[Code]....

the reason for this is one of the child nodes keeps the current synchronisation time in a project but I need a way to update the text field(I have done this) but refresh the child display?

View 6 Replies

Adding A Bunch Of Values To A List(Of T) Collection At Once?

Mar 12, 2010

I am creating an instance of a Generic List collection and I am surprised to find that I can't add more than one value to it at a time. I was thinking there was going to be something like what you can do with arrays, where you can add a group of values to it at creation. I saw the AddRange method, but that seems to add another collection to the end of this collection, which is not what I want. So my code is:

vb

Dim MyList as New List(Of String)
MyList.Add("John")
MyList.Add("Bob")

[Code].....

View 18 Replies

Adding To List Collection Generates Error?

Sep 27, 2011

I'm trying to populate class properties where one property is a list collection. I get a NullReferenceException when trying to add to the list collection. The code (litlle bit simplified) is here:

Public Class Portfolio
Property Name As String
Property Assets As List(Of Asset)
Public Sub Populate(ByVal data As DataTable)
For Each row As DataRow In data.Rows
[Code] .....

I have a nested class "Asset" inside the class "Portfolio". Everything goes ok until the line
Me.Assets.Add(asset)
Which gives me the NullReferenceException error.

View 4 Replies

C# - Find And Insert Into List Class Collection?

Mar 10, 2011

I have class called GroupSelect and made a collection List(Of GroupSelect)().[code]...

View 1 Replies

Collection List Print - Console Writeline ?

Oct 5, 2010

Just trying to print all list collection in a simple routine, variable repeat over and over except for the different collection list:

Dim p2 As New clsTranReq()
p2 = x.Deserialize(objStreamReader)

[CODE]........................

View 2 Replies

How To Create Collection Class And Add List Of Items

Oct 13, 2009

How to create collection class and add list of items to collection class that stores list of items?

View 3 Replies

Replace Two Dimensional Array With A Collection Or List?

Mar 17, 2010

I am using 2 dimensional arrays for my work. My problem working with them they are incredibly slow for my work. I am starting the array with randomly assigning values (non zero) to the array. Most of the array values are zeros as shown in below form (e.g. 5 x 5):

[Code]...

View 5 Replies

VS 2008 - Two Dimensional Array / List Or Collection

Jan 29, 2010

Is it possible to have a two-dimensional array/list/collection such as the following. The first dimension is to have 2 elements, 0 and 1. The second dimension I would like to be able to have a different number of elements for each of the elements in the first dimension. To explain better, I'd like X in array (0, X) to go up to say 4 and Y in array(1, Y) to only go up to say 2.

So there would be:
array(0,0)
array(0,1)
array(0,2)
array(0,3)
array(0,4)
array(1,0)
array(1,1)
array(1,2)
But no array(1,3) or array(1,4).

I'd also need to be able to use Redim Preserve to increase the size of the second dimension for each of the first dimension's elements.

View 8 Replies

VS 2010 Create Some Type Of List Or Collection

May 22, 2010

I want to create some type of list or collection. Each item on this list or collection will need contain A string name and a integer value. Something like

[Code]...

View 4 Replies

Calculate Sumproduct By Applying LINQ To List Collection?

Feb 24, 2012

Can I calculate sumproduct by applying LINQ to List collection?[code]...

How to return the weighted Percentage for each category with LINQ? Weight is the Value.

View 5 Replies

Dynamic List From DataTable.Select Rows Collection?

Jun 6, 2011

I'm am creating a "pop-up" CheckedListBox over a button on my DataGridView. The values in the list are going to be filtered based on the value in column 0 of the DataGridView.I have already pulled in a "master" DataTable with two columns: ACODE and MATRIX.I want to call the following function and return an array of strings that I can use to build this CheckedListBox with. The line between "For Each r" and "Next" generates a "Number of indices is less than the number of dimensions of the indexed array". The number of items is variable in the array so I can't predefined it. I know I'm going down the wrong path.

Function StudyGroupSamples(ByVal sampleType As String) As String()
Dim thisArray() As String
Dim theseRows() As DataRow

[code]....

View 2 Replies

Globally Declared Collection (List Of) Not Maintain Values Across App

Mar 10, 2012

I've been building a simple card game in VB using VB 2010 express. I've built a simple Card class, as follows:
Public Class Card
Public Property Number As Integer
Public Property Suit As String
Public Property Image As String
End Class

I setup a base deck to create the unique, individual cards, which will then be used in multi-deck games. I have a game table form where the cards will be displayed. I declared this base deck inside the game table form and built it during the form's load event:
Public Class Main_Table
Public baseDeck As List(Of Card) = New List(Of Card)
Private Sub Main_Table_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myCard As Card = New Card()
[Code] .....

Everything runs fine up until the end of Main_Table_Load. I've inspected the baseDeck values and they are correct. But when the Build_Deck_Click sub is invoked, the baseDeck collection's values become all the same, specifically it becomes composed of copies of the last card I built. I've stepped through the code and expanded baseDeck to confirm that all Cards become the same. I've tried moving the Public baseDeck As List(Of Card) = New List(Of Card) to a different module, with the same results. Since I will be using the baseDeck list through the app, I can't declare it privately inside the form_load event, as I'd have to re-create it every time I need to use it.

View 2 Replies

Linq Query To Compare If Collection Contains List Of String?

Feb 3, 2012

I am using a path comparison to find any children tags which works well when there is only 1 tag selected. This is my code for when multiples tags are selected but it is not working. Can you point me in the right direction?

Single Tag Selection (working)
Dim tagpath = uxTags.SelectedItem.Text
lnqCases = From i In lnqCases Where i.HelpDeskTagItems.Any(Function(x)

[code]...

View 1 Replies

Looping Though A List Or Collection Of Controls Available In The Development Enviroment?

Apr 12, 2009

How can I find a List or Collection of User Controls available within the development enviroment and dynamically add them to a combox by their Name Property. I am looking for something along the lines of:

View 4 Replies

Collection Properties Display To List And Labels In Main Form

May 12, 2012

I'm having trouble with collections and how it works, what I have so far is classes and I have attempted to do collection but it is not working properly. I am trying to have the collection hold the classPerson,classCustomer, and classPreferredCustomer properties, and then display it to list and labels in the Main form. [Code]

View 7 Replies

VS 2005 : Make A Comboxbox List The First Item In The Collection By Default?

Nov 25, 2009

How can I make a comboxbox list the first item in the collection by default in other words i have a collection list

1
2
3
4
5

When program loads I want combobox to load 1

View 10 Replies

.net - Storing Subcollections (filtered Versions Of The Main Collection) Inside The Collection As Cache?

Jan 15, 2010

Is it good practice to store sub-collections of item X inside a parent collection of item X for caching 'filter-queries' which are performed on the parent collection? (They won't be used together (as in color AND type).) Or is it also ok to just Loop over the collection and return the correct entities in a temporary collection?

[Code]...

View 1 Replies

Adding A List (of Class) Or Collection As Another Class's Property

Apr 2, 2010

I'm looking for a tutorial on how to Adding a list(of Class) or Collection as another Class's Property.What I am after is something like the Columns Collection for the DatagridView control.I would like to add Items in the graphics screen. Where the item list is displayed in the left panel and the selected Item properties are displayed in the right panel.

View 4 Replies

Make A Custom Collection That Take Advantage Of The Collection Editor?

Feb 8, 2010

I have been researching for a couple of days now and to no avail. Does Anyone know how to make a custom collection that take advantage of the collection editor? I would like to be able to have 3 Color Values, 1 Boolean and 1 String.

View 15 Replies

Passing List / Collection From Class To Class

Apr 28, 2009

I seem to have problem with passing a collection/sorted list/ list of strings from one class to another.I am using property procedure to pass it, however nothing is sent to another class. There isn't any error messages either.[code]

View 3 Replies

.net - Collection Initializes For Read-only Collection Properties?

Jul 25, 2011

I'm trying to support Basic.NET on my framework so I'm trying to convert C# 4 code to Basic.NET 10. Microsoft is committed to "co-evolve" these two but I'm having a problem with collection initialization... I found that I can initialize a collection much like in C#:

[Code]...

View 6 Replies

.net - Search The Collection Of A Collection In LINQ Where Clause?

Apr 15, 2009

I've got the following ADO.NET Entity Framework Entity Data Model:I want to find all the Policyholders with both a Service of a given Id and also a Keyword of a given Status.

This LINQ Does Not Work:

Dim ServicesId As Integer = ...
Dim KeywordStatus As Integer = ...
Dim FoundPolicyholders = From p As Policyholder In db.PolicyholderSet.Include("Keywords").Include("Services") _
Where p.Services.Id = ServicesId _
And p.Keywords.Status = KeywordStatus _
Select p

The Where clause cannot search the p.Services and p.Keywords EntityCollections in that way.

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved