Is There A Forms Collection
Mar 29, 2010is there a forms collection inn vb.net?Essentially, I want to iterate though the forms and take action depending on particular settings.
View 2 Repliesis there a forms collection inn vb.net?Essentially, I want to iterate though the forms and take action depending on particular settings.
View 2 RepliesI'm sure you've all seen this a lot before (in a variety of forms) but I think (hope) it's a bit different. <Not actual names of variables>I have two forms (form1 and form2). Form1 has 2 class-level variables, a string (m_String) and a collection(colCollection).Inside form1, the collection is loaded using a key. With an if-statement, the collection is matched to input (from a combobox) through the matching key.The chosen string from the collection is then passed to the m_String (confirmed with MessageBox.Show(m_String)
View 5 RepliesI have a custom collection which is derived from a base class implementing IEnumerable and IEnumerator, this collection is populated with custom objects.I'm trying to set the datasource on a ComboBox on a WinForm to use the above collection - but when the code is run the ComboBox is always empty.
The code I was using was this:
Private Sub ViewSources_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' declaration
Dim sourceCollection As SourceCollection
Dim source As Source
[code]....
Using vb.net 2008 Forms. I have a groupbox consisting of several textbox's and a push button. I put this groupbox in a control collection in order to validate each texbox when the push button is clicked.
The code to do this is as follows:
Private Sub bn_updateadditem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bn_updateadditem.Click
Dim InvalidInput As Boolean = False
Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1})
Dim ctrl As Control
For Each ctrl In Controls
[Code] .....
This worked great. However when I moved this groupbox with all its controls onto a tab, the groupbox contents disappeared from the form after the control collection is created and contents validated (per above code).
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]...
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].....
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 RepliesI'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]...
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]...
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]......
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]....
search the collection of a collection in my LINQ Where clause?
View 11 RepliesTake 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?
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]...
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]....
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 RepliesIs it possible to print to a collection(), then prompt to print the collection?
[Code]....
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 RepliesWhat 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].....
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?
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.
how can I place all timers on a form into a collection
View 2 Replies[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]...
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.
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]....
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?
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 RepliesWhy does this work:
_dgvHistory = DGV.Rows
For Each row As DataGridViewRow In DGV.Rows
DGV.Rows.Remove(row)
[code]....
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.
I have two collections that I am comparing to a thrid collection. Both collections have 147 values in them. I am wondering how I get the results of the comparisons in a text document concatinated to look like this:
Output from Collection A Comparison
Collection B results
Repeat the above two line until all results have been written to the text file. Currently the program runs and the document is not created. Here is the code:
Dim sb As New System.Text.StringBuilder
Dim ordersCount As Integer = &H3E8
Dim i As Integer
[Code]......