Answered Reading From Collection?

Dec 8, 2009

I am working on a small program that reads items from a text file. The items are the split up into data and used to fill the menuItem() as menuItems. Each instance of menuItem has 3 properties (name(string), price(double), and menuType(string)). As an item is selected, it's price is added to the Order collection with :

Order.Add(menuItem(index).price)

The running total of the sum of the selected items is to be displayed in text box. I have,

txtTotal.Text = FormatCurrency(runningTotal()) ' with runningTotal as a function
Function runningTotal()
For Each menuItem As MenuItems In Order

[code]....

However, when run, this error appears. This is new coding to me, so if I'm just way off, let me know. Anywho, I tried with & without the CDbl. It doesn't seem to have any effect.

View 1 Replies


ADVERTISEMENT

Reading Dataset To Collection Gives Two Time As Many Rows?

Oct 1, 2011

devicetypecollection = New Collection
devicetypecollection.Clear()
For Each dr1 As DataRow In _Default.ide.dtds.Tables(0).Rows

[code].....

View 3 Replies

VS 2005 Reading Files And Placing Them In A Collection?

Jul 23, 2009

I have created football (American) play creator. When the user is satisfied with a play he has created it is saved it as a file with a .play extension. What I want to do is to cycle through all the files in a folder (probably named after the team), and place each one that has the .play extension into a CList (of ClPlay) collection.I have been able to successfully load one play at a time by using this code...

Dim fs As Stream = New FileStream(diaOpenPlay.FileName, FileMode.Open)
Dim bf As Runtime.Serialization.Formatters.Binary.BinaryFormatter = New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
Dim Play As CLPlay
Play = CType(bf.Deserialize(fs), CLPlay)

...but that was when a specific play was selected from a load dialog box. This time I want to load all the plays in a folder and store it in a collection, and I'm not sure how to modify the above code to do that.

View 2 Replies

Reading Unlike Delimiter Text Files Into Collection?

Jun 13, 2009

I want to read a text file with unlike delimters into a collection.This is what the file looks like:

_Item 4916 0.00 781.21

_Item 2831 0.02 842.25

there are 10029 items and i am trying to get each items description into 3 different collections: Item "names" (first column), Item "weights"(second column), and Item "values"(third column).the delimiters are as follows:

______(3 spaces)____(1 space)____

considering the amount of items in the file, it would be a complete waste of time to edit it.

View 15 Replies

Answered Get Portion's From A String?

May 13, 2009

I was wondering what the easiest way is to get a portion of text from a string for example, you have:

"example1,example2,example3"

And i need to be able to get all three of the items separate:

"example1"
"example2"
"example3"

The length and number of items will change, I'm using a listview subitem

View 2 Replies

Answered Cant Convert ObjectGuid To String

Mar 24, 2010

I cant get the objectGuid from a computer via Active Directory.I cant work out the converstion to a string..I have added some code below to show where I am going wrong..It works fine write up until it tries to update the tree view with the "objectGuid".[code]

View 5 Replies

Answered DataRow System.NullReferenceException

Oct 13, 2010

I have a MyDataGridView.DataSource = MyDataSet.Table(0) and the AllowUserToAddRows = True Once the user have finished typing in the column zero I have to check if they didn't type invalid stuff. It have to be numeric and 4 chars long.

the code is:

Private Sub Result_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Result.CellEndEdit
If e.ColumnIndex = 0 Then

[code]....

And it is not all the time, but depending on how quick and stupid (i'm expecting stupid users, as usual) I click on the previous row or the AddNewRow row I get a the damn System.NullReferenceException on my If line:

If Not (IsNumeric(Result.Rows(e.RowIndex).Cells(0).Value) And Result.Rows(e.RowIndex).Cells(0).Value.ToString.Length = 4) Then I'm really not in the mood of just put a Try Catch, as it looks like bad programming in this case. I've already tried a couple variations with "is nothing" but no success?How could test it won't cause a Null exception before testing the row value?

View 4 Replies

Answered File Limit In Folder?

Feb 20, 2011

So i make a program that saves text files in one folder, but what i need is to make the file limit in folder..For example, i have limit 200 files, and when i add a new file, how do i delete the oldest one, or if the limit is changed to 100, how do i delete all the old ones, to make the limit 100?

View 2 Replies

Answered Making A My.Settings Bit Of Text Bold?

Aug 12, 2010

I'm using My.Settings to store some text information which will be displayed to the user under certain conditions. What I'd like to know is whether part of the text (not all of it) can be formatted in bold?

The reason I'm storing in My.Settings is because it can be customized but not to the extent where I need to store it in a database. And while I'm at it, is it possible to format parts of MessageBox text and labels in bold, or is this an all or not at all situation i.e. changing the font property?

View 2 Replies

Deployment :: Answered Uninstalling Programs Using Force?

Aug 11, 2009

I'm currently in a situation where I need to uninstall a certain program from a local computer (and automatically install a newer version of that program), because this old version of the program randomly causes my program to malfunction I have found this article:CodeProject: How to list all Programs installed on Computer and Uninstall Them . Free source code and programming help This shows how to start the uninstall program for the programs I need to uninstall, which is a good start. I also have created all the code needed to install the newer version of the program But as this program will be used by users, I want to minimize the number of times the users has to do something. So far the only popup that I haven't been able to get rid of is when the uninstall program is being run how to force it to uninstall without having the program ask for confirmation?

View 4 Replies

Get Hits On Searches No Matches Have Answered Quandary?

Mar 19, 2009

I have searched the forums and although i get hits on my searches no matches have answered my quandary. I am using visual studio 2008

So to the question: I have 10 label's named label1, label2 label3 etc. and i have a dataset with 2 fields and 10 rows (2x10) i would like to create a for loop like the following:

for x = 1 to 10
label(x) = ds.row(x).field(0)
next

View 3 Replies

How Many Phones That Application Called Answered Phone

Sep 1, 2010

i want an application (i do not care if it is a web app or a desktop app) that i will insert a mp3 file and a .txt list of phone and it will automatically call each phone one by one and will play the recorded message that will exist in the .mp3 file.i also want to be able to see how many phones that the application called answered the phone and how many did not.Topic closed for blatantly violating the rules. If you "want an application", post a request in the "Post a Job" forum. [rules][/rules]

View 1 Replies

Answered Forward And Back Buttons For File Explorer?

Sep 22, 2009

I am making a custom file explorer, and I am trying to make back and forward buttons, all I need to happen is when you hit back, it returns the last directory you were in, when you hit forward it returns the directories you were in before hitting back, and when entering a new directory, it erases all of the Forward data. I am not sure how to accomplish this

View 2 Replies

Forms :: Answered Hide Form From Windows 7 Taskbar Thumbnails?

Dec 3, 2010

I have a program with which I can open a second form on a beamer, this works perfect, but what I do notice it that on the taskbar (I have windows 7) I see the main icon of the app but also the form that is created.What I would like is that the second icon is not displayed on the taskbar thumbnails, this way I can't close the second form by the X but only by a button on the main app.

View 2 Replies

[2005] Application - Voice Modem Basics - How To Detect When The Call Is Answered Though

Jan 30, 2009

I spent some time with data modems till I realized it's a voice modem that I'm going to need in my application. I see that there are some other commands for a voice modem, although nothing very elaborate. I would imagine you make the call as you would in a data modem ATDT etc and it looks like there is really just one command to send audio...

AT+VTX
AT#VTX

Not sure what this is all about except maybe just different standards? Still not sure about how to detect when the call is answered though. I won't be talking to another modem. Maybe the serial port itself has a pin change or something? You would think there would be a bit "somewhere" that the modem would generate when it quits ringing. I may have build my own outboard box to do this. (easy enough -- probably more reliable too -- modems sure need rebooting a lot it seems).

Here is the goal though --Voice modem calls out, call is answered, and I inject my audio from the PC sound card for a minute or so and then tell the modem to hangup.

View 5 Replies

.net - Storing Subcollections (filtered Versions Of The Main Collection) Inside The Collection As Cache?

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

C# - Edit List Collection : Error Note Collection Was Modified - Enumeration Operation May Not Execute?

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

Make A Custom Collection That Take Advantage Of The Collection Editor?

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

.net - Collection Initializes For Read-only Collection Properties?

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

.net - Search The Collection Of A Collection In LINQ Where Clause?

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

Accessing And Adding Items To A Collection That Is In A Collection?

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

Collection Index Must Be In The Range 1 To The Size Of The Collection?

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

Search The Collection Of A Collection In LINQ Where Clause?

Apr 15, 2011

search the collection of a collection in my LINQ Where clause?

View 11 Replies

.NET LINQ - Count Of Collection Within Collection?

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

Asp.net - Add Controls To A Collection And Update From Collection

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

C# - VB Collection - Convert To A Modern Collection?

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

Collection Of Lines - Using The Collection.contains?

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

Reading, Then Using, Then Reading Text File?

Jan 2, 2010

I am working on a project in VB 2008 and need it to do this:Read first line from text file (using Openfile)Enter line into textbox on formDo some other codeThen Read second linefrom text fileEnter line into same text boxand loop until we have gone through text fileI am not sure how to read line by line from text file then enter it in textbox. I can open the Openfile and get the filename and everything, but I just am not sure how to read from it or enter that line into the textbox.Here is what I have, its not much but its a start:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim FileReader As StreamReader

[code]....

View 4 Replies

Print To A Collection() Then Prompt To Print The Collection?

Aug 4, 2011

Is it possible to print to a collection(), then prompt to print the collection?

[Code]....

View 2 Replies

C# - .NET Collection Only In VB?

May 31, 2012

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 Replies







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