Logic Using Files And Parallel Lists
Mar 25, 2011
Direction with some logic using files and parallel list.. I have to create a summary of a current clients portfolio using the client id I have in a textbox. I've everything to work except the summary of the client. I have several sub functions that I can use that I've made up in my code. They are frmMain_Load that have a file and a string holding the client txtfile to a file
Dim clientFile As System.IO.StreamReader 'file of client data
Dim clientFileName As String = "faclient.txt" '
And I have two functions Private Sub GetStockData(ByVal sCode As String, ByRef sName As String,ByRef sPrice As Double) and Private Sub GetNextTran(ByRef tid As String, ByRef tcode As String, ByRef tdate As Date, ByRef ttype As String, ByRef tshares As Integer, ByRef tprice As Double). I have to add to a label,a summary tha shows the stock code, stock name, number of shares currently held, current share price and value(shares times current price). The number of shares currently help will be the result of adding the shares bought and subracting the shares sole for that stock. If the number of shares help turns out to be zero(client sold all the shares they bought), do not display the line. The program should not assume there is an upper limit to the number of different stocks a client can hold. I know is alot..But here is what I have so far..
Private Sub btnSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSummary.Click
'get a summary of client portfolio and value
Dim summaryCodeList As New List(Of String) 'holds scode
Dim sharesList As New List(Of Integer) 'holds tshares
[CODE]...
View 4 Replies
ADVERTISEMENT
Jan 26, 2012
I am going to be creating an application which will monitor a folder, which could be a network folder and when new files are added in that folder it will notify the application. On notification application will import those files names into a listbox and will give the option to user to organize(move) those files into a different directory.
1. I have to implement a logic for monitoring the new files in the folder.
2. I have to move it into new directory and in some cases I will have to create those new directories as user specify.
For the first step I am confused to either implement it as a windows service using FileSystemWatcher class, example can be seen here. [URL] or do a file check based on timer, lets say every 5 minutes. If I do it as a service how can the service notify application?
View 1 Replies
Jan 16, 2012
I have a service that scans network folders using a parallel.for method. However recently I am finding if I stop the service then while windows says the service is stopped the process is still running in task manager. However it is at 0 cpu and the memory does not change. If I try and end the task (even a force in command prompt) it just says access denied and i have to reboot the server. What would be the best way to make sure everything terminates? I thought of adding a global Boolean that in the stop procedure it turns true and part of my parallel code will check for that and call s.stop.
View 1 Replies
Jul 27, 2010
I'm working on a program that lists all of the files on all of the drives on my computerI'd comments. To use the program Start a new Windows Forms application and replace the code on Form1 with the code listed here.
Imports System.IO
Imports System.ComponentModel
Imports System.Globalization
[code].....
View 19 Replies
Sep 3, 2010
The application uses ADO.NET to invoke sprocs for nearly every database operation. Some of these sprocs also contain a fair amount of domain logic. The data access logic for each domain entity resides in the domain class itself. ie, there is no decoupling between domain logic and data access logic. I'm looking to accomplish the following:
[Code]...
View 2 Replies
Apr 1, 2011
I have two lists. One list is a list of names, the other list is a list of how many times each name is found in the first list noted in the database
so...
Nick
John
Jim
Jack
is the firs tlist
10
13
13
2
is the second list. Nick had 10, john 13 and so on.I want to sort the second list from large to small, but have the index for the first list still linked to the correct amount of calls.i do it this way so I can
for x = 0 to num_of_names
string = lst_name(x) & "-" & lst_count(x)
next x
View 3 Replies
May 20, 2010
I know how to check whether an item exists in a list using (MyList.Contains), But I do not know how to check the whole list. For example (use one button and one richtextbox):
[Code]...
View 14 Replies
Jan 19, 2012
In many of the articles I have read on the web say that when creating properties in vb.netthey should use the get/set methods and a private/protected member variable in the class.
Like so:
Public Class Person
Private _name as string
[code].....
View 3 Replies
May 1, 2009
in my page Having 4 Buttons ..(FIRST,PREVIOUS,NEXT,LAST) ..i am confusing to this one..
Actually what i am doing is Iam developing one efrom Designer in this user is adding pages..
so We have given These Buttons (before told)..so user click on First Button page goto Starting page and When click on Next Button Goto Next page ..like this
View 5 Replies
Oct 15, 2010
I have 3 tables:Sales data - SaleID, Date, StoreID, CategoryID, Cost, Retail
Store names - StoreID, Name
Category names - CategoryID, Name
I have a dgv bound to my sales table, and 2 comboboxes, one each bound to the remaining tables, with display member set to the name, and value member to the ID.
An ID of -1 represents "All Stores" or "All Categories"
An ID > -1 represents a specific location or category
So, can I use some sort of If,Then,Else logic to do something like this:
SELECT (*) FROM Sales
WHERE (IF @StoreID > -1 THEN StoreID = @StoreID ELSE True)
AND (IF @CategoryID > -1 THEN CategoryID = @CategoryID ELSE True)
AND Date BETWEEN @Date1 AND @Date2
I've found some different examples of If/Then/Else and Select Case type logic for SQL using google, but they don't seem to fit my situation, and I'm not sure how to apply that to what I'm attempting here.
View 2 Replies
Mar 4, 2012
I've got a problem when I'm trying to refresh my form. I've narrowed it down to why I'm getting this error so I'd be interested to hear people's opinions because logically, I don't think I'm approaching this the correct way.
I read from a table that gets x number of records. From the results, I create dynamic check boxes. It's OK if x is greater than the previous refresh but when it's less than, I can still see the old objects.
If I completely close the form and re-open it, it works fine and that is exactly what I'm trying to emulate. However, I'm failing miserably. Here's a broken down version[code]...
View 5 Replies
Oct 14, 2009
I have a datafield [Money] of datatype float.when i input currency value with $,or , it throws an error.How do I allow $ or "," to this field without changing the datatype(I know changing to type money may fix it)
View 3 Replies
Feb 28, 2011
While building an xml document I require to use logic to dictate the outcome of the xml; logically it is similar to the following piece of code (although this does not work):
Dim buildElement As Boolean = True
Dim xe As XElement = _
<xml>
[code]....
I have managed to do this using the method show below, is this the suggested way of doing this or is there a better one??
Dim buildElement As Boolean = True
Dim xe As XElement = _
<xml>
[code]....
View 1 Replies
May 2, 2010
How can i write logic to check is it my sql statement being insert into my database ? is there any ways to create or thing can check thru by using webservice?
View 13 Replies
Apr 10, 2012
I want to create a logic to calculate the age and unit from entered birth date. eg: If the difference between birth date and current date is >= 24 months, I will want it to display the age in years. If >= 8 weeks, I will want it to display it in months and so on here's my code
[Code].....
View 9 Replies
May 26, 2010
I have been programming in vb6 for few time ago and i used open SQL Server connection and command objects to make database transactions. I have been searching for similar approaches in vb.net too but not finding any starting point. How can we work similarly in vb.net application?
View 2 Replies
Jan 26, 2011
I never used POCOs, so I have the habit of putting a lot of logic in my business object classes. Hence I believe I'm missing some important concepts about class-layouts, and the thought-process that is needed here.
Say if you have two classes; Company and Employee. Could you give some examples of what classes you would build "around" these that take care of various behavior/validation etc.? (Like some class names, and a brief description of their purpose)
View 2 Replies
Apr 30, 2012
Looking at the following
Instead of a message box, how can I make it round when the unit price field is tabbed off of. If they tab in to the unit price field don't round, if they tab out of it, do.
Private Sub UnitPrice_LoseFocus(AllowLoseFocus As Boolean)
' Runs logic to round unit prices with long decimals
' Enter price rounding here
[Code]....
View 2 Replies
Apr 5, 2009
I want to be able to call forth hundreds of different photos be selecting them from a listbox or something of that nature.
Normally, if I only had a few images, I would amke their visibility false and then use If statements to turn on their visibility once it is selected. However, putting hundreds of images on to a form and then changing their visibility, seems like a pain.
I was wondering if there is a way to call forth each photo within the resources folder when an item is clicked so I don't have to put each one directly on the form.
View 5 Replies
Mar 17, 2009
I'm sure this should be easy but I'm having trouble getting my head around it. I shall try to explain what I need as best I can.I have a string called SoftwareGroupName. If that string is empty, I need to run some code that logs a call in our Helpdesk. So far, so simple.I then check two other variables, AuthorityLevel and InstallType. If the AuthorityLevel is anything other than "OnRequest" then a call is logged in the Helpdesk System. Again, so far, so simple.
The problem occurs when the AuthorityLevel is "OnRequest". At this point, the application should again log a call in the Helpdesk Call with a status of "Resolved" as well as add the user to the relevant group in Active Directory.What I need to be able to do is, effectively, say "If the AuthorityLevel is OnRequest and SoftwareGroupName is not empty then go ahead and create the call and update the group. However, if softwaregroupname is empty then DON'T even try and update the group and create a call with a different status (e.g. Assigned).Here's what I'm doing so far. But it seems wrong to have to check that SoftwareGroupName is empty twice.
[Code]...
View 4 Replies
Oct 7, 2009
We have a system were a user chooses a combination of days from a calander. We then insert a values in the databse based on the following [code]So if they picked Monday and Friday we would insert 34, or if they picked Monday,Tuesday and Thursday we would insert 22.Now my question is how do I reverse this easily in code, to find out what days they have picked. So I get fed 22 from the database how do I figure out what combination of days make up that value. The only thing I can think of is creating the mother of all case statements but I know there must be a better way.
View 4 Replies
Dec 2, 2010
im using tasks parallel library in .net 4.0 i want to have the ability to specify a task for each core independant of the other cores. usually in TPL, i create a task and i tell it to run in parallel, i have no control over the number of threads created nor can i control the number of cores to participate in the parallel task. also, i cant specify each particular core a different task.i'd like to know how to achieve this in TPL if it is possible.
View 3 Replies
Nov 11, 2009
Is there any way of doing parallel processing in VB.net. Like running a IF-ELSE and CASE in parallel.
For example i'm incrementing a counter in a IF-ELSE statement. And for each count i need to display some thing using a case statement.
View 11 Replies
Apr 15, 2010
tell how to form this to the correct Syntax?ere the sample in sequential form:ForEach ctrl AsCheckBoxIn tblCKBoxCollection.Controlsctrl.Checked =
View 1 Replies
Mar 31, 2011
I have been reading up on the parallel programming and even now still a little confused on the whole concepts. Lets say I have a single project with about 5 classes that interact and have local variables in methods and variables accessible to all methods in a single class and even 1 or 2 variables accessible to all classes accessed through instantiation. Now using threads I know that global variables would be overridden by multiple threads if there were no locking applied but local variables to a method/function do not, right?
So if I ran the project multiple times meaning as a new process, the methods and variables would be thread safe right and no data corruption occurs? So to implement parallel programming using the task factory, if I created a project that basically creates tasks and each task is basically running an instance of another project, then shouldn't the variables and data be thread safe and safe from corruption? But what if I had the output files and they named by Output & datetime.now.tostring, would there be conflict issues and I ask this knowing that I have seen this happen when trying it. [Code]
View 1 Replies
Feb 3, 2011
I have an small physics toy application I am developing. It works fine except the particles will not push each other away, only pull towards, I debugged that sub going through it command by command and realised the value 'H' would not change, what ever it was set to during the first pass through the sub is what it kept, the only way to change this value is to manually set it i.e 'h = 1'. Once the calculation is redone on the 'H' value it resets to what it was previously, even though the x1,y1,x2,y2 are all different, thus meaning H should be different.
I think it is me that has made a mathematical mistake somewhere, but I cannot see where it is. I need a fresh pair of eyes to look over my work. Please let me know if you find anything.
[Code]...
View 1 Replies
May 12, 2010
I have a button on my form that loads a dialog. I have a logic on here that I want to test, what ever method I try I alway's get 'Object reference not set to an instance of an object'dialog1.vb:
Code:Public mainform As SettingsMainForm If mainform.LogicCheck.Checked Then textbox1.text = true End if
View 2 Replies
Nov 23, 2011
I am a student working in a co-op position. My project is to add a login page to an existing site (made using FrontPage, I believe) and I am using ASP.NET in vs2010 (VB). I would like to NOT use the login control/membership tools in ASP.NET. I was hoping to make my own login and use session variables to keep track of the users and determine their role off of a field in a table located in the database that currently exists for the site.
Like I said, I am still a student and haven't had a lot of web application experience. I'm not asking for someone to do this for me. I have spent a few days looking over the asp site, the msdn site, and several others but I just can't understand it yet.
View 1 Replies
Jul 22, 2009
I'd like for debugging purposes to be able to log what functions are called and in what order. So I've been just putting Debug.WriteLine("myFunctionName(args)") all over my functions, logging it in the end to a file. Isn't there a better approach to do this?
View 4 Replies
Aug 15, 2011
I am going mad trying to sort this logict
Public Sub Panels()
If RadPanelSearchCur.Visible = True Then
RadPanelTenant.Visible = False
'RadPanelProp.Visible = False
[code].....
the idea is if one panel is opened the others are closed?
View 3 Replies