Using The Observable Collection?

Oct 3, 2011

I am creating some user controls in vb using winforms. I ran across the observable collection and INotifyChanged events and was wondering if this type of action was available in winforms As I understand it, the observable collection is a WPFapplication, but it would be nice to use this type of functionality in a winform as well.

View 6 Replies


ADVERTISEMENT

Observable Collection Is Not Updating Datagrid

May 6, 2012

I am using a Dim All_PriceLists As System.Collections.ObjectModel.ObservableCollection(Of BSPLib.PriceLists.PriceListPrime) where PriceListPrime implements Inotify for all properties in it.

I bound the All_PriceList to a datagrid as DataGrid1.ItemsSource = All_PriceLists but when I do All_PriceLists=Getall() where Getall reads and gets the data from the DB, the datagrid is not updating.[code

View 3 Replies

Wpf - Add Multiple Classes To An Observable Collection?

Jan 30, 2012

I'm still teaching myself how to bind and use observable collection. One problem that I'm a little confused on is binding multiple classes/observable collection to one page. In other words, if I have a PersonName class and a AnimalName class, I have to create two separate observalbe collections for each? How would I set the datacontext when a page only allows one?

[code]...

Now If I add another class, how would I combine the two on the binding part and collection part.

View 2 Replies

Wpf - Multiple Views Of Observable Collection?

Mar 13, 2012

I've been working on this problem for a while and I'm clearly missing something...I create, populate and bind an observable collection like so:

Dim _ObservableWEI As New ObservableWEI
...
_ObservableWEI.Add(New WEI() With {.WEInum = 1, .WEIvalue = 1})[code].....

The problem is the filter effects the contents of both listboxes. I guess I need a specific instance of the collection to apply the filter too or something

View 1 Replies

Wpf - How To Bind Observable Collection And Save To Database

Feb 1, 2012

I will be doing an MVVM Project soon and I'm working a couple tutorial/examples out. How do I take the following code and connect it to a database. If I were to have a datagrid, how can I change information in the datagrid and have it automatically update? I'll be using MS SQL.

[Code]...

View 1 Replies

Sort Items In ListView By Column Bound To An Observable Collection?

Sep 28, 2011

How to sort items in ListView by column bound to an Observable Collection ?I've looked all over the place and I can't find anything easy enough or simple on this.

View 2 Replies

Wpf - Sorting Observable Collection Incorrectly Sorting?

Aug 20, 2011

I have a WPF ObservableCollection which is bound to a ListBox and I have a Sort() method which when called will convert the ObservableCollection to a List(Of T), and undertakes a sort based on a date/time column within the collection.

The data is sorted, even when new items are added to the ObservableCollection, however the date/time isn't being correctly sorted. The data is sorting based on the date however it is very much random when it comes to the time portion. The following is an example of the outcomes I am experiencing:

[Code]...

Is there anything that I am doing incorrectly in this method that would cause the time portion not be included in the sort? Is there a better way of doing a sort?

View 1 Replies

Updating Observable Colelction From List?

Oct 7, 2009

I have my datgrid's itemsource binded to a observablecollection. Every 5 secs my client app resceives a list from the server which i use to update the observable collection. The problem is that when it updates the grid seems to reset (if details is open when i update the details collapses, if i have an item selected it will un-select)

Here is the code that i am using to update my observable collection:
Private Sub creategriddata()
Dim svc As New ServiceReference1.Clientthing then re-adding

View 3 Replies

.net - Massive Memory Leak When Binding ItemsControl To An Observable Colleciton?

Feb 21, 2010

I have an ItemsControl in a ScrollViewer. The ItemsControl.ItemSource is set to the Observable Collection.Every time I add an item to the collection, my application nearly doubles in memory usage and eventually after enough adds.

Here is a rough sketch:

<Scrollviewer Name="MyScroll">

[code]....

Using ANTS Memory Profiler, I can see all the class instances in my App. When I start the program, I have 150 instances of TextBox (There are three in the datatemplate). When I add a studyunit to the collection, I have 303. Adding another leaves me with 456... 609... etc.The studyunit objects inherits from dependency objects and I am only binding to its dependency properties. I made the studyunit a series of dependency properties due to this article: [URL], but it didn't fix anything.Update 2/22/2010. Here is the actual code (code above was very simplified and created from memory)

Private Sub ObservableCollectionChanged(ByVal sender As Object, ByVal e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
If e.Action = NotifyCollectionChangedAction.Remove Then 'q removed

[code]....

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

.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







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