Get Key And Value From A Collection Program?

Sep 21, 2011

How do you get the key value from a vb.net collection when iterating through it?[code]...

View 2 Replies


ADVERTISEMENT

Convert Collection.foreach From C# To Program?

May 12, 2009

In C# i just put the method in the parentheses that i want to run on each row of the collection, but it isn't working in VB.NET.[code]...

View 1 Replies

Data Management Program - JIT Collection Was Modified

Dec 21, 2011

I'm have a data management program. I've fixed everything in it, except when I run my Insert or update commands on a different computer I've installed it on, JIT tells me that the collection has be modified, it then gives me the option to continue or quit. I know it's been modified, the user knows it's been modified, how do I get rid of that?

View 10 Replies

Using Modules - Program That Uses A Tabcontrol - Each Tab Represents A Collection Of Common Tasks

Nov 26, 2011

I have a program that uses a tabcontrol. Each tab represents a collection of common tasks and, as one would expect, has a bunch of controls on it.

In my original version of this app, I simply put all functions/subs/etc related to a specific tab right in the main form class; I just divided them with lines and a few extra blank CRLF so I could jump from section to section within the code (literally named Tab1 Code, Tab2 Code, and so forth).

I am re-working the program and thought I'd use modules for this instead. So, I built all the forms and grabbed the code from the previous version, created a new module, then pasted the code into the module. VB.Net 2010 has choked all over this with a zillion errors. The functions/subs are all public, but they cannot see any of the controls on the main form. Every control that is in existence on the main form comes up as being not declared in the module.

This is the first time I've tried to use a module without a full class, and the first time I've tried referencing back to controls on the main form in this fashion (I've always just used it for functions/subs that I pass data to). Am I trying to do something here that shouldn't be done or...? I basically just want to create files so I can segregate the code into a more logical design.

View 4 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

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

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

.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

Accessing And Adding Items To A Collection That Is In A Collection?

Apr 6, 2012

currently in my application I have a Global Collection that is a Collection of Collections.Currently I am trying to add items/ elements to one of the child collections of the Global Collection but I am unable to use the collections methods of the child.When I assign a variable to the child collection and return the collection it is just an object with the collection inside.

Ex:
Dim GlobalCollection as New Collection
Dim ChildCollection1 as New Collection
Dim tempCurrentCollection[code]......

View 3 Replies

Collection Index Must Be In The Range 1 To The Size Of The Collection?

Dec 17, 2009

I've been working with a CMS called InsiteCreations 2008. I'm running into an error I just can't wrap my head around. I would even be willing to compensate anyone a small amount over paypal, for a solution. The error is rare in occurance, and appears when clicking about 3-4% of links to other pages within our CMS.The full code page is quite large, but there seems to be only one function associated with the error. The error also only appears when not logged into the CMS. If logged into the CMS, clicking the link simply displays the page as normal. I have already checked permissions on the page from the CMS admin console, and it is public.

The error message is as follows:

Server Error in '/' Application.Collection index must be in the range 1 to the size of the collection.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

[code]....

View 2 Replies

Search The Collection Of A Collection In LINQ Where Clause?

Apr 15, 2011

search the collection of a collection in my LINQ Where clause?

View 11 Replies

.NET LINQ - Count Of Collection Within Collection?

Apr 14, 2011

Take the following scenario:

Public Class Store
Public Overridable Property Areas As List(Of Area)
End Class
Public Class Area

[code]....

What's the quickest way to get a total count of shelves for a store? I.e. for a store I get the total count of areas by using Areas.Count Or will I need to loop through each area and tally the count of shelves?

View 2 Replies

Asp.net - Add Controls To A Collection And Update From Collection

Mar 25, 2011

I have an ASP.NET app with lots of textboxes all over the page that need updating at various points through program execution. These textboxes actually belong to a certain class, so for easy updating I thought I could create a Dictionary(Of string, object) and add the control.ID and the control to it and then for updating do something like this:

[Code]...

View 3 Replies

C# - VB Collection - Convert To A Modern Collection?

Jun 26, 2012

I need to convert a VB Collection to a modern one, like Dictionary or Hashtable. For my approach, I need the Collection's KEYS. Googling tells me that it's impossible. Re-writing the entire application using new collections is not an option as the application is really old and large (converted from VB6 to VB.Net).Using the old Collection also is not good - as there are new components in development.Converting a - for example - Hashtable to Collection works:

using VBCollection = Microsoft.VisualBasic.Collection;
public static VBCollection ToVBCollection(this Hashtable table)
{

[code]....

View 1 Replies

Collection Of Lines - Using The Collection.contains?

Aug 12, 2009

I have a collection of lines and as i loop through through the collection, i need to see if it aleady contains a certain line; however, the contains method wants a string and i have stored lines, so how can i use this method to see if my line is already in the collection so i don't place it in there twice?

View 7 Replies

Print To A Collection() Then Prompt To Print The Collection?

Aug 4, 2011

Is it possible to print to a collection(), then prompt to print the collection?

[Code]....

View 2 Replies

C# - .NET Collection Only In VB?

May 31, 2012

Why is the Collection in the Microsoft.VisualBasic library? Why is it not in a more general location. Is there a reason Microsoft "hid" it from C#?

View 3 Replies

Use Value From A Collection?

May 29, 2012

What I'm trying to do is get the value from a collection. While debugging I can see that the value from my collection is exactly what I want.

This line contains the value I want: Groups.Add(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1))

All I'm trying to do is export all the values to a textbox, and I can't seem to figure out how I can use it.

Below is just some more of the code I'm working with.

The property of the line is {Microsoft.VisualBasic.Collection.KeyValuePair} the key has no data, but the value has what I need.

Dim equalsIndex As String
Dim commaIndex As String
For i As Integer = 0 To propCount - 1

[Code].....

View 3 Replies

VS 2010 : Program To Save Settings To Another Program Without Running The Program That Is Being Edited?

May 5, 2012

is it possible by 1 program to save settings to another program without running the program that is being edited?

View 6 Replies

.net - Add XElements To A Collection?

Oct 21, 2010

I am populating an XML structure (using VB.NET) to pass to a web service. Here is how one piece of the structure is filled, and the rest of the structure is filled in a similar manner:

Private Shared Function GetSpecialties(ByVal specialties As System.Data.Linq.EntitySet(Of Provider.provider_specialty)) As XElement
Return _
New XElement( _

[code]....

Some pieces of the structure can contain up to 30 elements. Each record takes about .1 seconds to create, and it needs to create about 35,000 records, so the whole process takes about an hour.Is there a quicker way to fill an XML structure like this?

View 1 Replies

Add A Structure To A Collection?

Sep 18, 2011

Recently I found that I'm not able to instantiate a structure for an array:

Dim mObjectLists() As New objectLayout

Ok, fair but It's an easy way to store a bunch of data in an array instead define a class. And after that I tried to define this:

Dim mObjectLists() As Collection

And add structures to the collection. But it says you should instantiate the reference object first. I searched about creating own Collection based on the base collection class but I think It's wasting time to write a code with class inheritance instead the first sample.

View 1 Replies

Add Timers To A Collection?

Jul 19, 2010

how can I place all timers on a form into a collection

View 2 Replies

ASP.NET / VB Iterate Through Collection

Jul 7, 2010

[This is a simplified example] I have a collection ("myCollection") in which exists three entries: ("hello", "goodbye", "welcome"). I want to iterate through the collection and if in the collection there is the entry "welcome" I want to take one action, if that entry doesn't exist I want to do something else. Like this (pseudo):

[Code]...

View 1 Replies

Bug In Collection Class VB?

Aug 16, 2009

The following code creates a Collection where every Item is assigned a value equal to the last item added. At the end of adding for example seven items all the entries are identical to the last one added, although each has the correct key

The parameter passed to the function - aCOA() - is a comma delimited string of three strings.

The code is as follows
Public Function myCOA(ByVal aCOA() As String)
Dim thisCOA As New Collection
Dim keyCOA As String

[Code]....

Is this a bug in the code or in the Collection Class. I have traced the operation of the code and all seems OK until the second entry is added at which time the first entry Item get the same value as the second entry Item and so on.

View 2 Replies

C# - DataTable Vs Collection In .Net

Apr 22, 2010

I am writing a program that needs to read a set of records that describe the register map of a device I need to communicate with. Each record will have a handfull of fields that describe the properties of each register. I don't really need to edit or modify the data in my VB or C# program, though I would like to be able to display the data on a grid. I would like to store the data in a CSV file, or perhaps an XML file. I need to enable users to edit the data off-line, preferably in excel.

I am considering using a DataTable or a Collection of "Register" objects (which I would define). I prototyped a DataTable, and found I can read/write XML easily using the built in methods and I can easily bind to a DataGridView. I was not able to find a way to retreive info on a single register without using a query that returns a collection of rows, even though I defined a unique primaty key column. The syntax to get a value from a column is also complex, though I could be missing something on both counts.

[Code]....

View 5 Replies

Collection, Class .. Which Is Best For Example

May 25, 2009

I have worked some with classes and collections in the past but seek some direction before I start on this project as to the best method to use.I will be reading 20,000 or so lines from a text file. partno, desc and loc Each will contain 3 elements to be collected and stored temporarily.There are 2 results that I desire that relates to selling of products

First Result: Sorted list of most used partno, desc
2,234 partno (most sold)
1,345 partno (2nd most popular)
etc.

2nd Result: Sorted list by specific loc., partno, desc
loc. 45 - 234ea partno, desc
loc. 45 - 143ea partno, desc

Maybe end up with the top 500 selling products in the list. This data will then be added to a dataviewgrid for printing and then deleted.So, to temporary store and sort should I use some type of collection or classes? I know how to fight my way to either but which would be the best method?

View 3 Replies

Custom Collection In ASP.NET

Oct 6, 2009

I have built a class to store profile information and there is another class that inherits System.Collections.CollectionBase that actually holds the data objects. Now the issue is when the page is refreshed the entire class is wiped off the map.

View 1 Replies

Datagridviewrow Collection?

Oct 12, 2009

Why does this work:

_dgvHistory = DGV.Rows
For Each row As DataGridViewRow In DGV.Rows
DGV.Rows.Remove(row)

[code]....

View 3 Replies

Every Nth Item In A Collection In .Net?

Dec 16, 2009

Nearly identical to How can I get every nth item from a List<T>?But I'm having trouble turning

List<T> list = originalList.Where((t,i) => (i % 5) == 0).ToList();

Into VB.Net code.

View 1 Replies







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