Fastest Way To Hold A Big List Of Something?

Jun 24, 2009

so the way I have this working now I'M using System.Collections.Generic.List(Of T) for holding 100's of a structure.Dim Users as New List(Of User)

I was wondering if there was any better way or faster list container or something like this in the .net framework?

View 5 Replies


ADVERTISEMENT

Fastest Method To Load A List Into ListView Control?

Aug 14, 2011

When ListView is not in Virtual mode the following method seems to be the fast method to load a large list into ListView:

Dim items As New List(Of ListViewItem)
Dim alllines as String()=System.IO.File.ReadAllLines("FilePath")
For each line as string in alllines
Dim item As New ListViewItem
item.Text = line
items.Add(item)
Next
ListView1.Items.AddRange(items.ToArray())

View 2 Replies

Making A List Box Hold A Value?

Nov 30, 2011

I am a first year coding student and we are starting out with Visual Basic. Up until now I have been able to figure everything out, but I have run hard into a wall and I don't feel like I've been taught how to get over it. Here's the thing.

First Form

Contains a list box for products selected, and four text boxes for Subtotal, Tax, Shipping and Total.

Second & Third Forms

Each contain a list box of books to select from which will be added to the first form.[code]....

I feel like I am doing it wrong right out of the gate - as you can see I am going by the item that the user chooses, and adding a constant value that I have pre-defined in a module. Then I add the name of the book to the first form - but here's the issue.That text string doesn't hold a value.SO, when I use the remove button on the first form - the text string removes but the subtotal, tax, shipping and total boxes do not change in the least bit because the item that I removed doesn't retain any value.

View 6 Replies

Generics - List(Of T) - Use It To Hold Items Of Several Types?

Oct 3, 2009

Assuming a base type of "Message"...

[Code]...

I would like to have one collection of Message objects which can be either PhoneMessages or MailMessages, so that I can iterate through the list and deal with each message based on what type it happens to be.

Attempting just to use .Add() fails, saying that I can't add an item of type PhoneMessage to a List(Of Message). Is there some elegant way to accomplish what I'm trying to do? I had thought I could accomplish this with generics, but I think there's a gap in my understanding. If it can be accomplished in .NET 2.0, that would be ideal.

View 4 Replies

Limit To The Maximum Amount A List(Of T) Can Hold?

Aug 3, 2009

Is there a limit to the maximum amount a List(Of T) can hold? I need to know because I have a program that could potentially wind up in a really large loop that would add over 200 or so items to a list at one time.

MSDN search didn't really tell me much, but I'm in a rush at the moment, and was just wondering.

View 8 Replies

Create A List (of My Custom Structure) To Hold Only Unique Items?

Mar 8, 2012

How can I create a list (of my custom structure) to hold only unique items? This list should be created from another list.[code]...

View 5 Replies

VS 2005 List(of T) - Create A List To Hold More Than One Control Type Or Create A List For Each Control Type?

Jan 20, 2011

If I create a list for a TextBox:

[Code]....

I am able to only add controls that are of type TextBox. My question to you is, can I create a List to hold more than one control type or do I have to create a list for each control type?

View 8 Replies

Fastest Way Of Searching For Row In A Dataset?

Dec 5, 2011

I have a program that scrap websites and "puts" the information into a table.

My problem is that now and then i get values that i already have in the table. to avoid getting duplicates i search thru the table first to see if the value exist or if the record exist but might be in need of getting updated.

My table contains 60 000 records and is growing.

first i filtered a datagrid but it takes to long so i used the "select" method on the dataset table but it takes longer.

the program loops thru thousands of websites so it'll be doing a search for every website and the added time to collect the data just takes too long.

View 6 Replies

Performance - Fastest Casting In .NET?

May 14, 2009

When I have many controls on a Form (i.e. Label, Button etc) that do almost the same thing, I often use one method to handle all the controls Click, MouseDown, MouseUp events.But to know which of the controls throwing the event and access the properties of that control I need to cast the "sender" object to the correct type.

The thing is that I always know which type it is, I don't really have to "TryCast", "DirectCast" and check if the operation returns true. I some times use CType as well.

[Code]...

View 2 Replies

Repeat Some Instructions The Fastest?

Sep 23, 2008

epeat some instructions the fastest?i tried this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
start()

[code]....

View 7 Replies

Fastest And Efficient Way Of Creating File In .NET

Jul 28, 2010

I've an arraylist having 30000 items in it, what's the best way of creating a text file on the fly from an ASP.NEt page? Currently I'm using the code below but it times out with large data,[code]

View 3 Replies

Fastest Pixel Monitor Method?

Apr 19, 2012

I have a pixel I want to monitor for change. For example, first it is white, and suddenly it is black, and then changes back to white. My method is not fast enough to get this change.any changes I call the function below to get the original color of the pixel. Then I have a timer that runs every 1 ms to take the color of the pixel, and if it's not equal to original color; do something. For example counts the time the pixel has changed. However, this function does not run fast enough. Is there any faster methods to check the pixel? The function returns an ARGB code of the pixel color.[code]....

View 3 Replies

Fastest Way To Generate Thumbnails - Without Bogging Down The UI

Apr 29, 2012

The fastest way to generate thumbnails using VB.net and multiple computers without bogging down the UI. Right now I have 3 computers and I run an instance of my thumbnail generator code on each. One computer hosts the images. The other two computers access the folder of images via the network. My code is written to compare the main folder and a thumbnail folder to see if new thumbnails need to be generated. If so, a thread is generated and the thumbnail generation code is ran on the thread. There are 5 threads created in all. So, theoretically, across 3 machines, I'm getting 5 independent threads and I'm thinking that Windows 7 automatically spreads the load across the local cores. In an effort to avoid duplicating work, the comparison is done before the generation of each thumbnail.

This method is faster than using only one computer but drags down the performance on all computers (THE UI also becomes unresponsive). I'm looking for a better way to

1.) Produce the thumbnails as fast as possible

2.) Keep all UI's responsive (boy possibly controlling the priority setting) and

3.) Done within a single instance of the program.

In the #3, I mentioned that I would like to use one instance. Is it possible for networking information be used by the hosting computer that will allow threads to run on the other 2 computers? This way, the 15 threads will be controlled by a single host computer.

Here is a snippet of my

Public Sub CreateThumbsFUNCTION(ByVal IMAGE As String, ByVal MAXDIMENSION As Integer)
'following code resizes picture to fit.
'IMAGE needs the full path
'If thumbnail already exists, it will skip

[CODE]...

View 28 Replies

Fastest Way To Parse A Tab Delimited File

Mar 29, 2010

I was wondering if anyone had a better(faster) way to parse a Tab delimited file in VB.net. I need to read a file into an SQL table and the file contains about 300,000+ rows. Takes quiet a while. at the moment i have the below [Code].

View 6 Replies

Sorting Algorithms Preferably Fastest

Jan 19, 2012

I am quite new at VB.NET and just need helo on sorting algorithms, prferbly the fastest (quick sort) but bubble would so. It is for sorting and array for 12 numbers, which are being enter by the user via a input box. These are then transfered onto a listbox for visual aid. so the steps involved would be: (already done)1) Enter then inputs into array via inputbox2) Input to sppear in listbox (not done)3) Sort the array ascending/decending4) print results into the listbox again.In my code there is also a total and a average, but that doesnt need any help on it. [code]

View 4 Replies

VS 2008 .rtf Files Search Fastest Way?

Sep 4, 2011

ive a folder with a few hundred .rtf documents. am making a program to search some text in them.the way currently im employing is having a richtextbox on my form and serially loading each file in the richtextbox and if the search text is found in it,adding it to a list.but this is time taking,

View 4 Replies

VS 2008 Best And / Or Fastest Way To Switch Between Forms

Jul 2, 2009

In my project I have 3 different forms. They all have the same design layout so the only different you see is where the text boxes and buttons are placed. Right now I have 3 buttons at the top of each form that Im using to switch between the forms

[Code]...

I know there is probably a much better way of doing this, and faster. I dont' like the delay between each window showing/hiding. what options do I have to make this run better? Since I have the same design background is there I way I can just hide and show just the controls instead of showing/hiding the entire window?

View 6 Replies

Fastest Method Of File IO And Content Manipulation?

Apr 20, 2010

My current project is to process several files. The files come from a Unix server and have been SFTP'd to the Windows XP machine. (That's fixed protocol, I don't have control over it.) My problem now is that the Unix new line characters and Windows characters don't match. The solution is to read the file line by line and replace 0x0A with 0x0D + 0x0A, or Asc 10 with Asc 13 + Asc 10, or vbLf with vbCrLf, however you like to say it.Well I have a working function to do this, but any extra speed I could squeeze out of it would be fantastic. The text files I'm working with can reach sizes of about 100MB. So to the question:

Q: What is the fastest way to read a file in, change characters as necessary and then write the file out?Here is my current working code.

Private Sub FormatCharacters(ByVal files As String())
Try
For Each fileName As String In files
FileSystem.Rename(fileName, fileName & ".old")

[code]....

View 1 Replies

Fastest Alternative To Datatable.Select To Narrow Cached Data?

Sep 28, 2009

I have a search function on my company's website (based on .NET 2.0) that allows you to narrow the product catalog using up to 9 different fields. Right now, after you make your selections on the frontend I am building a dynamic query and hitting the database (SQL Server) to get the resulting list of items numbers. I would like to move away from hitting the database everytime and do all of this in memory for faster results. Basically a 3500 - 4500 row "table" with 10 columns: the item number (which could be a primary key) and the 9 attribute fields (which have repeating values for many many rows).

There can be any number of different searches between the 9 columns to get the items you want:
Column A = 'foo' AND Column D = 'bar'
Column B = 'foo' AND Column C = 'bar' AND Column I = 'me'
Column H = 'foo'
etc...

Based on my research, the .Select() function seems like the slowest way to perform the search, but it stands out to me as being the quickest and easiest way to perform the narrowing searches to get the list of item numbers:
MyDataSet.Select("Column B = 'foo' AND Column E = 'bar' AND Column I = 'me'")
In my specific case, what method I use as an alternative that has the same narrowing functionality and better performance instead of settling for the datatable.select() method?

View 2 Replies

Forms :: Find Replace Text From File - Fastest Method?

Nov 13, 2011

1) a text document which has content like :

uber|uber|ultra
taxi|taxi|taxi cab|cab|minicab|airport taxi|airport transfer
genitalia|genitalia|genitals

[code].....

View 1 Replies

Best Way To Hold App Settings

Dec 2, 2010

I'm building a new industrial app using MODBUS/TCP talking to a DAQ unit that will have a lot of parameters and will need to be adaptable for different scenarios. For example, the units I'm connecting to have 12 inputs and 6 outputs, mapping for those may be different for each installation, and in one instance I'll be talking to 4 units together - if that's the best way to do it - each one will have identical parameters, just a different ID number and ip address. They will all be writing to a SQL Server database. Not sure if I'm better off having a Tab control with each unit on a separate tab or a different instance of the app for each one. Is one better than the other? The units will be polled every 200-500ms. 500ms seems to be more stable.

With so many parameters, is it better to store all them inside the application and access them through My.Settings or would I be better storing them in a database, either the SQL Server DB or maybe something like SQLite (one of my faves) or is there a better way?

Not done anything quite as big as this before and first time with MODBUS, but that bit is working a treat.

View 1 Replies

Hold A Date Value?

Nov 11, 2009

I am writing a program that is going to take two dates (entered by a user) and compare them against each other to determine when something was purchased vs when it was paid for. I'm ok with everything except one part, and its a biggie, how do I have the user enter the dates (format) and how do I convert it from a string to a recognized date format? Does that make sense?

View 4 Replies

Hold Left Key Down?

Mar 13, 2012

Currently, I use SendKeys.SendWait("{Left}")

How can I hold the left arrow down?

View 13 Replies

How To Hold Up A Console App

Oct 26, 2011

I really want to do this the proper way, it's just that I've been doing it the wrong way for so long, I can't seem to get past it.

in a console app if I start a timer or kick off a thread or bgw, the sub main runs right on thru and the app finishes and closes.

i need the sub main to just hold position until some event is raised then handle the event and come back to sub main or end depending if the event that was raised told us to end or not.

what I would normally use is this:

Do While KeepLooping
Wait(5D)
CheckTimedEvent()
Loop

View 5 Replies

VS 2010 - Hold Key Down For Only One Second?

Jun 4, 2012

So, if this is how to hold a key down for an infinite amount of time:
keybd_event(CByte(Keys.Right), CByte(MapVirtualKey(Keys.Right, 0)), 0, 0)
How can I hold it down for only 1 second?

View 3 Replies

Run The Exe And Not Have Any Sub Folders To Hold The Images?

Jan 22, 2009

i have maid a program witch has images in it from my hdd. Now when i build my program and send it to other ppl thay cannot see the images. i know this is becaws the path i directed to pull the images from is not on there pc nor do thay have the images lol. so my question is how do i put the images in the actual exe as in the actual program that i have built so all the images and stuff are all in there. so thay only need to run the exe and not have any sub folders to hold the images.

View 1 Replies

How Many Rows Can A Listbox Hold

Jul 11, 2011

I have over 9,00,000 records in my Access database but only a fraction of that is being displayed in the listbox. How Many Rows Can A Listbox Hold? Around 65K is the answer I got from my research.

View 3 Replies

Structure To Hold 2 Strings?

Nov 29, 2011

I like to create a Structure that could hold 'Yes' or 'No' only; just like a Boolean variable could hold True or False.

View 12 Replies

Using XML As Database And Uses Dataset To Hold The Xml?

Jan 6, 2010

im using XML as my database and uses dataset to hold the xml. which one do you think is better to backup my xml?

1. write the xml to 2 location, default location and the backup location

dataset.writexml(path1)
dataset.writexml(path2)

2. write the xml to default location and copy it to the backup location

dataset.writexml(path1)
copyfile(path1,path)

if you have a better way of doing it please dont hesitate to share it..

View 1 Replies

.NET Snake Game Freeze When Hold A Key Down?

Dec 24, 2011

I'm trying to make the classic Snake game in VB.NET, but if I hold a key (any key) during the game, after a few seconds the game freezes until I release the key. I've tried lots to fix this, but nothing works, maybe because I don't understand the problem.I'm assuming that when I hold down a key, the Form1_KeyDown function gets called, and when, after a few seconds, the key goes into "I'm being held down" mode, that function is constantly called, so the timers don't get a chance to update. But like I said, I'm probably wrong.

I've been struggling with this for a while. I think this is all the necessary code, please let me know if it isn't.

[Code]...

View 3 Replies







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