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


ADVERTISEMENT

File I/O And Registry :: Writing Generic FileSave Routine For Collections

Mar 12, 2009

I want to write a generic file saving routine where the routine is passed data in the form of a collection and it sets a containsStructure flag. I wanted to be able to save the data from the collection, but if it is a collection of structures I want to be able to extract the data from the structure to write to the file.

The only trouble is, that I cannot do something like:
For Each s As dataStructure In data
Next
Since the compiler complains that dataStructure is not defined. Is there a way to code around this?

View 3 Replies

Fire The Timer Or Other Routine While Still The WHILE TRUE Routine Checks For Incoming Connections And Messages?

Jan 24, 2012

I am using sockets to send message between computers. I send the messages alright. What I want is when the message "x0x" comes, the client must be closed within 5 minutes. Teh admin can cancel the request by sending message "-xx" as well. The routine that checks for incoming connections and accepts messages uses WHILE TRUE...END WHILE since it must always listen. Once I get a message, I need to fire a timer control or other that fires within 5 minutes. But the program cant leave the WHILE TRUE at all. If i exit it early, the timer fires and the program does get exit. How do I fire the timer or other routine while still the WHILE TRUE routine checks for incomin connections and messages?

View 5 Replies

Reference A Particular Code Routine In .net External To The Current Loop/routine?

Apr 17, 2011

is there any way to reference a particular code routine in VB.net external to the current loop/routine?Example:

If Var01 < 5
[Routine A]
Else
[Routine B]
End If

where Routine A and Routine B are code sequences at the end of the entire program -- such as outside of the current sub or class? The idea would be to reference an otherwise repetitive code.

View 4 Replies

Asp.net - Share A Variable From Sub Routine To Sub Routine?

Mar 3, 2009

I have a sub routine where I pull in information from a database. I want to use variables from this sub routine in another sub routine. I tried making everything public but it doesn't want to be friendly and share.

Dim strEmail as String
Public Sub readDB()
strEmail = "whatever@doohikcy.com"

[Code]....

The readDB would read the database and set the variables and do whatever it needs to do. Then when they submit the form it would e-mail the form to whatever the email address was.

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

Multiple UI Thread - Show An Animated Loading Gif Image Till Data Loading Is Completed In All Text Boxes

Jul 13, 2009

I have a window application develpoed in vs 2008, framework 3.5, in which i have put a button.. Now where i click that button the other text boxes are filled up with the data from database thru web service.. what i want is while all text boxes are being filled i want to show an animated loading gif image till data loading is completed in all the text boxes.. i have tried to use image picture box but while data is loading gif image is displyes but in static mode.. cant see animation... i think this is because data loading and animation both are done thru one UI thread..

View 8 Replies

Add Progress Bar To This Routine?

Jul 30, 2009

What would be the best way to add a progress bar to this routine so that it corresponds with the progress bar?[code...]

View 6 Replies

Have To Hit Tab Key Twice To Fire Routine In Dgv

Jun 22, 2010

When entering a value in dgv I want the Tab key to fire a routine. Works out ok only thing is I have to hit the Tab twice before it fires. Don't know why, is there a way to prevent it, so that I have to hit the Tab key only once ?

View 1 Replies

Sub Routine Not Executing?

Feb 4, 2011

I have the following code:

Code:
Imports System.Data.SqlClient
Imports System.Data
Public Class Main[code]...

and the sub Exceptionquery is not working. I can verify this because it is supposed to create a new table called scratchpad3. what I may be missing in that sub routine that isn't allowing it to work?

View 8 Replies

Using The SendKeys Routine?

May 28, 2009

I was looking for something send keystrokes and I found this helpful routine SendKeys that I can use in a VB Script. I wanted to have "Right Control Key + (Scroll Lock & Scroll Lock)" sent to the machine. Essentially, having the Right Control Key pressed, I need Scroll Lock pressed twice. Here is what I tried:

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys"^({SCROLLLOCK}{SCROLLLOCK})"

View 3 Replies

Why Is Sub Routine Not Firing

Feb 4, 2011

I have the following code:

Private Sub Exceptionquery()
Dim connection As System.Data.SqlClient.SqlConnection
Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"

[code]....

I get the error Invalid Object name 'Scratchpad3' on this line:

adapter.Fill(ds)

I have tried to debug this and can see that the query is correct, that the values that are being passed to the sql server are correct but it doesnt look like my code is firing off the Exceptionquery Sub. I thought to call a sub all you had to enter was the name of the sub such as this line:

Exceptionquery()

I have also verified that the mapping of the buttonclick event is mapped correctly. I have other subs that I am calling in almost the same way and those work.

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

C# - CSV Parser In One Routine/function?

Mar 9, 2010

I know there are several libraries of code out there that can parse CSV files according to the standard, but, for various reasons, I need one simple routine (not an entire library) that parses a CSV into a DataTable or array. Does such an animal exist or is it extinct? (Preferably C# but i can translate vb.net too)

View 3 Replies

Check Winner Sub Routine?

Jun 21, 2010

I am writing a noughts and crosses game and everything works but the checkwinner sub routine, so basically if someone gets three X's or O's in a row then a message box pops up saying either X has won or O has won.Below is what I have written in the sub routine.

[Code]...

View 2 Replies

Get Routine To Resume The Downloads?

Jun 7, 2012

I'm trying to get this routine to resume the downloads.I use the same routine to download a file all the way thru non-stop..so at least the download part is working..however either the stop commands i'm using or the resume routine i thought would work is all ass backwards I'm not gonna make any conclusions or anything on this one..made myself look stupid the last time i know you all are def smarter than me when it comes to this stuff,,and dangit that just erks me to no end i tried adding a exit do in the do loop..and that of course exits ok,,but when the file is resumed is larger than its supposed to be.

[Code]...

View 4 Replies

Speeding Up A Matching Routine?

Jan 21, 2011

I hoped you could give me som tips about speeding up som code i have to match an item to a collection of items... I have 1250 items that need to find the best match from 16774 items(every item is a class that consist of a string variable containing the path to an image, and 9 fields containg the most dominant color from a collection of 13 colors(the closest color)) The program does not use the filename or do any color matching in this step, only check the 9 fields... but it takes so

[Code]...

View 1 Replies

Sub Routine Within A Shared Subroutine?

Apr 9, 2010

How do I refer to a sub routine from within a shared subroutine? When I try the following code I get this error:Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

Namespace CmdLineArgs
Friend Class Program
Shared Sub Main(ByVal args As String())[code]....

View 3 Replies

Write A Routine Using An Array?

Dec 31, 2009

I need to write a routine that enters real (scientific) numbers into an array of 20 spaces then adds all the numbers together and prints out the contents of the array plus the total value in a format such as: 1.0 + 2.0 + 3.0 + ...... + 20.0 = 210.0 in Visual Basic 2008.[code]...

View 16 Replies

Writing A Routine Using Dates?

Jan 2, 2010

I need to write a routine that compares the difference between any date in the past and the system date, showing how many days have elapsed since that date.

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

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

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







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