Collections Of .NET EntityObjects Contain Any Of The Same Objects?

May 19, 2009

Pages have Roles. Users have Roles. A user may only view a page if he and it share one or more roles.

This works:
Dim Allow As Boolean = False
CurrentPage.Roles.Load()
For Each r As Role In CurrentPage.Roles
r.Users.Load()

[Code]...

How can I make it compare only the Role Id values to determine equality?

View 1 Replies


ADVERTISEMENT

.net Collections: Copy Objects From One Collection To Another?

Nov 24, 2011

I'm implementing a customized Graph algorithm in vb.net, and I'm having the following problem:

Supose the code:

dim col as new collection
dim myC as new system.collections.genericList(of myClass)
dim obj1 as new myClass
dim obj2 as new myClass

[code].....

'In the next statement, the myC2 inside col collection will be decreased to contain 'only obj1, like myC. I supose this is for myC and myC2 contains only a pointer to 'objects obj1 and obj2 as well col contains pointers to myC and myC2 myC.remove(obj2)'The problem is that I have to only copy myC to myC2, like a ByVal argument in a function,'instead a ByRef argument, in order to mantain a copy of objects in myC2 while these 'objects should be removed from myC. How should I do it?

View 2 Replies

Collections Of Objects With Variable Data Type?

Jan 27, 2010

lets say I have:

arecord.name = "A"
arecord.value = 15 ' a number of type "long"
'
I then

call records.add(arecord,arecord.name)

' so far, so good but lets look at the next record

arecord.name = "B"
arecord.value = "this is text" as opposed to a number of type "long"

'can I then
call records.add(arecord,arecord.name)

View 3 Replies

Sql Server - Obtain A List Of Collections Which Contain Objects Which Implement An Interface In C#

Aug 28, 2010

I am new to .Net Programming and would like to know if Reflection is suitable for traversing an Object to discover Collections within an instance of a class. I am working with the Microsoft.SqlServer.Management.Smo Namespace.

The plan is to connect to a database, determine what collections exists, then for each of those collections, if the Collection exposes objects which implement the IScriptable Interface, generate a script for the object.How do i do the following (This is pseudo-code as I am seeking assistance with using reflection or some other method to do the following)

[Code]...

I would like to enumerate all objects in db with one function if possible

View 2 Replies

Asp.net - Value Of Type 'System.Collections.ArrayList' Cannot Be Converted To 'System.Collections.Generic.List(Of ITextSharp.text.IElement)'

Sep 21, 2011

I'm having a problem with this code in the highlighted line(*); getting the error in the heading.

Dim htmlarraylist As New List(Of iTextSharp.text.IElement)
htmlarraylist = *HTMLWorker.ParseToList(New StreamReader(tempFile), New StyleSheet())*

[Code].....

View 2 Replies

System.Collections.Specialized.StringCollection Vs System.Collections.Generic.List(Of?

Feb 5, 2011

[code]...

What's really the point in using the former?It's hard to use linq if I used the former. I have to convert that to an array first which is difficult because there is no (asarray) function.I think I would change all of my code that's using System.

Collections.Specialized.StringCollection to System.Collections.Generic.List(Of String)

View 2 Replies

Make Objects From The ToolBox Using Code Instead Of Changing Existing Objects Invisible Then Visible Later?

Dec 5, 2011

make objects from the ToolBox using code instead of changing existing objects invisible then visible later?

View 7 Replies

Sql - Error The SqlParameterCollection Only Accepts Non-null SqlParameter Type Objects, Not Int32 Objects?

Jun 23, 2012

I am getting this error, Not sure why it is happening "Error The SqlParameterCollection only accepts non-null SqlParameter type objects, not Int32 objects."I have tried with all sorts of possibilties, now try to enter default data as dummy data,

Using connection As New SqlConnection
connection.ConnectionString = ConfigurationManager.ConnectionStrings("DentalDeviceConnectionString").ConnectionString
connection.Open()[code].....

View 1 Replies

Modifying Objects Inside For Each Loop Sets Properties Of All Objects With Values Of Last One?

Jan 29, 2011

I have a program like this.

Module Module1

Public Class Mstr
Public Property Prop1 As String
Public Property Prop2 As String[code]....

But it is not working as I expect it to. You can see it from.The DtlsB properties of all three DtlsA objects are having values from last iteration.

View 1 Replies

Random Objects - Let The User Input Objects To A Richtextbox 1 Object On Each Line?

Jan 6, 2011

I want to let the user input objects to a richtextbox 1 object on each line, and somehow use Random.Next to select pseudorandomly a few objects, the number 'few' inputted in a textbox.

View 9 Replies

The SqlParameterCollection Only Accepts Non-null SqlParameter Type Objects Not String Objects?

Jan 18, 2012

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using conn As New SqlConnection("Database=Clinic_Management_System;Data Source=.SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|Clinic Management System.mdf")
Dim cmdRecord As SqlCommand

[code]....

View 2 Replies

VS 2008 Inherit ListView - Dispose Of Two Objects When The Form's Disposing Of It's Objects

Feb 7, 2010

I have a user control that inherits the FW ListView and I need to dispose of two objects when the form's disposing of it's objects. Here's what I've concluded already, am I on the right track?

[Code]...

View 3 Replies

Child Objects Raising Events In Parent Objects?

May 1, 2009

long story short, I have created a ListView type control, using UserControls for the parent control and the ListViewItems. Most the of the control is written and works fine, right up to the point where I tried to replicate the 'Control.SelectedItems(0).Index' property and the 'SelectedIndexChanged' event.

Each child object knows its index value, and could pass this value via the SelectedIndexChanged event (assuming this is how it works in a normal ListView control -- user clicks on an item, and that item fires an event updating the selected index value in the parent object).

How does the child object raise an event in the parent object? I have a feeling this could be done with Delegates, but I'm still learning about their usage.

View 1 Replies

ASP.NET Cast ArrayList Of Objects To Custom Objects?

Aug 9, 2011

getting the following error Unable to cast object of type 'System.Object[]' to type 'OrderService.webdirect_WebLinesRow[]'. On the line

webdirect(web_companyID, web_locationCode, web_customerNumber, web_orderNumber, web_orderReference, web_orderDate, webLinesArray.ToArray(), o_Company, o_LocationCode, o_CustomerNumber, o_OrderNumber, o_OrderStatus, o_OrdDescrip, webRespArray)

I created the webLinesArray.ToArray() array as such

Dim webLinesArray As New ArrayList()

Am I missing an additional cast or something ?

View 1 Replies

Compare Two Objects To Check If All The Properites Of Both The Objects Have Same Value Or Not?

Aug 28, 2008

I want to compare two objects to check if all the properites of both the object have same value or not. for this i need to use the reflection to enumarate through all the properties of an object and check the value of the property. To try the code just i have written a Employee Class having Two Properties EmployeeNo and EmployeeName. I am creating an object of the Employee class and need to write a function that can list the values of all the properties in the class.

[Code]...

View 2 Replies

How To Add Collections To Class

Feb 12, 2010

I would like to create a customer class and be able to add collections to it. I know I have to use List<T>. Look at the scenario below. I have a customer class, order class and address class. I would like to instantiate the customer class and add orders and addresses to it. E.g.

Dim oCustomer As New Customer("Acme Inc.")
oCustomer.Orders.Add(New Order(1))
oCustomer.Orders.Add(New Order(2))
oCustomer.Addresses.Add(New Address("Street 1"))
oCustomer.Addresses.Add(New Address("Street 2"))
[Code] .....

View 3 Replies

Using Collections In A WebService?

Mar 18, 2011

I created a website that contains a Webservice that transfers data to a windows application Using a collection, however, I get this Error that says that anything that inherits the ICOllection, it must implement Add(System.Object)

View 2 Replies

Bind Objects With Nested Objects?

Jul 21, 2009

I am tring to bind a class to a form where the class contains other class variables. For example:

Class Character
Private _name as String
Property Name as String

[code]......

View 5 Replies

Collections And Interfaces And Casting?

Nov 14, 2010

Say I have a interface called IProperties and I have a collection called colMyProperties that is a collection of IProperties. Then I have an object called clsProperty that implements the IProperty interface. Now, in my code where I add objects to the colMyProperties collection I add a bunch of clsProperty objects. so far so good.

Now when I try to access an object in the collection I can only access properties and methods of the IProperties interface, not the clsProperty object. What am I doing wrong? Do I need to cast the object?

View 2 Replies

Control Collections In A Tabcontrol?

Dec 21, 2011

I have a form with a tabControl on it. This tabControl has 10 tabs and each tab has multiple textboxes. I am trying to iterate through these textboxes, but cannot find which collection these textboxes belong to within the project.

View 2 Replies

Converting VB6 Collections To .Net Generics?

Apr 21, 2012

I have a VB6 project with about 100 custom collection classes which I want to convert to VB.Net. A typical example would be something like.

Class CAccounts
Private m_Accounts As New Collection
Public Sub Add(newItem As CAccount)
m_Accounts.Add newItem, newItem.IdKey

[code].....

All of the collection classes in the project use this standard approach. However, not all the properties/methods of the collection classes are actually used. Most of the collection are used in "for each" loops. Keyed access using the string key is quite common. Keyed access by index is much less common.

Ideally I'd like to take a standard approach to converting these classes. I don't really want to have to review each collection and it's usage to consider whether I need a List, Dictionary, etc. Some of these collection contain 100,000 objects, and some will only contain 10. However, on the other hand I don't want to cause performance problems by using a more complex structure where a simpler option would do.

Sticking with the old style Collection. So, it would be relatively easy to convert to VB.Net But, I'd rather move to the more modern structures.Have CAccounts Inherit KeyedCollection(Of String, CAccount). Fortunately most of the classes held in the collections do have the key as part of the class (eg CAccount.IdKey above). This seems to work well. However, relatively few classes will access the colelction by numeric index. So, perhaps this is overkill if I only want keyed access by the string key?Have CAccounts Inherit Dictionary(Of String, CAccount) for the classes where I don't need access by numeric index. The problem I have with this is that all the existing "for each" loops are like "for each account in accounts". I don't want to have to change all these occurences to something like "for each account in accounts.Values". Although perhaps I can get round this by changing the default property?Have CAccounts Inherit MyCollection(Of String, CAccount), where MyCollection is my own bespoke collection. This seems a bit too much hard work.

View 2 Replies

Create A Collection Of Collections?

Sep 16, 2009

Is there a way to create a collection of collections? e.g. I created a collection ListOf(Lines) After I add all my lines to it, I want to store this colleciton in another listOf(Collections). The reason I want to do this is because i want to create several separate collections of lines and I'll need to loop through them all to look for a certain line and I thought this would be a good approach if it's possible.

[Code]...

View 5 Replies

For Each Through Public Collections Within A Class

Sep 17, 2010

I have a class that is primary configuration for my application. It has 70 plus public collections that holds all my data. I am trying to do a For Each through each of these public collections, so that I can process the data through my code, but I am getting following error:

[Code]...

View 3 Replies

Generic Collections And Inheritance?

Aug 24, 2009

I have a parent class and many children class, right now it look like this:

Public Class Parent
Public Property ID as String
End Class

[Code].....

What I need is a strongly type list List(Of Child) that Inherits from ListOfParent (I need the FindByID method) but I can't find the right syntax.

View 10 Replies

Make Collections Last After Close?

Mar 10, 2012

Is there a code to make the contents of a collection stay the way that they (everything is still stored) are instead of being erased when I close my program?

View 6 Replies

One Routine For Loading Collections

Sep 2, 2009

I would like to have 1 routine to load data into different collections.I would like to use the below routine in a more dynamic fashion...be able to load a different collections with different data dependent on strSQL.Is there a way I can pass the collection I want to use.If so, in the below code how would I differentiate to load the correct data to the correct collection? [code]

View 22 Replies

Searching List Collections?

Mar 21, 2011

My problem is probably something simple..I am trying to load a list of a perticularcustomer.I will have to load the list of all the purchases they have make (amount of tickets purchased (rseat). It runs fine, but when I change the file name from fri to saturday and keep the call name the same it still searches to the name that is in the call name textbox. I dont want it to do that. I want it to say the there are no reservation for that name if I change the file.here is part of my code.

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
'resets file reader and put to the top of txtfilename

[code].....

View 2 Replies

Serializable Class Collections?

Apr 11, 2009

I have a class that contains a list of properties which serializes just fine. However I need one of those properties to contain a collection of another class to give me sub classes

Example XML
<VideoOptions>
<property1>value1</property1>

[code].....

View 2 Replies

Store Data In Several Collections?

Mar 31, 2011

I'm not sure how to do this but I want to store data in several collections. I want the data to be stored / accessed as follows.

CombatCollection("Joe").CombatRecord(1).AttackRecord(1).Damage

how these nested structures or collections are defined and used?

View 9 Replies

.net 2010 How To Work With Collections List

Feb 15, 2012

I'm trying to learn how to work with Collections list. In the past, if I wanted to create a list I would use an array and then save it to a text file after I was done manipulating the data via CSV.how to save things of different types to a list such as:

Name, Birthdate(as date), Salary

I know how to do this in an array but all the synapses aren't firing with the "new to me" collections list as collections lists are hard typed....

View 2 Replies







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