Create A Dually-keyed Collection?
Nov 18, 2010
I have a collection of objects in vb.NET. Each object has two different IDs, lets call them ID1 and ID2.
I need to be able to quickly find a specific object in the collection based on one of these IDs. In some cases I have ID1 and in other cases I have ID2. I'm currently using the Collection data structure with ID1 as the key, but that doesn't help me when I need to find an object using ID2.
View 1 Replies
ADVERTISEMENT
Apr 17, 2010
I am using the following Integer Validation on my TextBox5, but the problem is i am not getting the keyed in value in MsgBox.
Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
[code]....
View 3 Replies
Mar 17, 2011
I have a header table and a related details table with a one-to-many relationship from master to details.I understand that I will have problems saving details if the master data isn't already there, and I've been working around this. (VS 2008, SQL Express 2008, app is running on XP)
I've been getting around this by checking if there's any detail data on the save click event and warning the user that they need to save the master first before adding details.So the user then removes the detail, clicks save, and then adds the details and clicks save again. Although not good, that's been working OK, but now I need to make the details mandatory. So at the moment they can add a new record, save it and no details.What I would really like to do is to save everything at once. I saw a related post that said I needed to use a transaction, Is that the best approach? Or is there a way to save the master first then the related details all when the save button is pressed?
View 4 Replies
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
Jul 14, 2009
I have class called "Employee" and I have a class called Department. They have an association. I need to create a colleciton of employees with the creation of a Departmant. I know how to do with using "private" member _AllMyEmployees. But I need to expose this private member using properties. therefore how do i covert thsi private member to a property? [code]
View 2 Replies
Oct 17, 2008
Working on a project that tests up to 16 PC boards. The test routines are on a a backgroundworker thread. I want each PC board to perform the test routine on its own thread, so I would need up to 16 backgroundworkers.How do I go by doing this? Do I put 16 Backgroundworkers on the form? I tried to do it programmatically but I can't declare an array of backgroundworkers because withevents variables can't be typed as arrays. I guess I just need a kick in the right direction.
View 8 Replies
Feb 20, 2011
I have an issues creating Collections with Schedules, it creates the Collection, but it does not update membership as the schedule is blank [code]...
View 5 Replies
Mar 18, 2011
I'm writing a program that takes all files and directories on a computer and puts them in a collection, where I add a collection to the Collection for a directory with the key being the name of it and a string containing the Name for a file under the collections added I do the same,
[Code]...
View 4 Replies
Jan 24, 2010
How could I create something like a TreeViews' Node collection? I'm really not sure what to search for in this case.Presumably, you have something like an array of TreeNodes, and then the NodeCollection class implements IEnumerable, is that correct?
View 10 Replies
Apr 23, 2012
I am trying to maintain a total for multiple collection objects in a class. When I create a new object, it resets the total to zero, only adding the current value being passed to the function. I have tried to use a static variable, create a second variable to hold the old total while adding the new value. The base class holds the total value, while the sub class creates the new object that holds information. I am passing the new value to a function in the base class adding the new value to the total when each new record is created.
[Code]...
View 1 Replies
Feb 16, 2009
I got a blank, how do I create dynamically a number x of collection?
View 7 Replies
Apr 15, 2010
I'm trying to create a collection of variable binding in a class.It is intended to look something like this:
Dim x as integer, s as string
Dim c as new VBindClass
x = 1
s = "Hello"
[code]....
Is there some function that allow us to retrieve a unique ID for a given variable and also get/set based on variable?
Update:At last, I've managed to found the answer. Here's the code:
Dim gh As Runtime.InteropServices.GCHandle = Runtime.InteropServices.GCHandle.Alloc(obj)
Return Runtime.InteropServices.GCHandle.ToIntPtr(gh).ToInt64
View 2 Replies
Mar 4, 2011
How would I create a function to return one database row in a collection, such that the rows column name & value are stored as key/value pairs in the collection?
View 5 Replies
Oct 13, 2009
How to create collection class and add list of items to collection class that stores list of items?
View 3 Replies
Oct 12, 2011
I have a problem that can be best solved with LINQ. I have a class that has 2 properties of which 1 is a single. I have a collection of that class and I need to select the instance with the highest single value.[code]I'm having a hard time explaining this even this is a simple task. Please ask if you don't understand.In addition to my original question, How would I create a collection containing the 5 highest Instances.
View 2 Replies
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
Jun 17, 2012
I am a beginner on Visual Basic but was able to create the 'skeleton' of the application I need to build. Basically, it is an application dedicated to keeping a check on the vinyl I have. When I buy a new record, I want to effectively 'Add New Record' on Visual Basic and be greeted with a page consisting of various forms such as 'Artist' and Title'. Once these are filled in, I want to click 'Enter' and for all that information to be converted to one of the pages within my application.
Here's an easier look at it...
There are LPs that have 10" and 12" sections.
There are singles that have 7" and 12" sections.
In the 'Add New Record' page I want to also have a drop down list with the above elements in, once 12" LP is selected and all the other forms are filled in and I click 'Enter' - I want the application to send it to the 12" LP section of the application.
View 11 Replies
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
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
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
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
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
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
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
Apr 15, 2011
search the collection of a collection in my LINQ Where clause?
View 11 Replies
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
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
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
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
Aug 4, 2011
Is it possible to print to a collection(), then prompt to print the collection?
[Code]....
View 2 Replies