VB 2008 Array Processing And Sequential File Processing
May 19, 2011
Im a college student and this is my first programming class, i am having extremely diffcult time with arrays and sequential file processing. Im not asking for the whole program, just something to get me started and hints along as i progress with it. Please help me get started on my program, its due in 2 days.
Here are the requirements....
1. The program must input any number of individual�s last and first names using two separate textboxes.
2. The array of names must be sorted by the last name using a bubble sort. You must code the sort.
3. The program must be able to recall the names from the file and add to the existing list of names so that more names can be added to, sorted, and written back to the file in sorted order.
4. Sort in ascending order: A to Z
5. All names must be displayed in a listbox in sorted order when the user wishes to see them.
6. In the listbox the last and first names must be separated by a comma and a space. Example: Smith, Mary
7. The user must be able to search for a name in the array, using the binary search algorithm. You must code the search.
8. Do not use module-level variables. Instead you may choose to use Static.
9. The program must be designed using Visual Basic 2008
Is there an easy way to read in a comma deliminated file in VB 2010. In VB 6.0 you could read the file in directly to variables. It appears this has been removed in 2010.
I just learned some basics of multi threading in VB.net recently as I came across processing a large List of records and inserting them into SQL database one by one.
I have code look like this:
Private Sub btnLoadNow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadNow.Click
Dim autoLoad1 As New Thread(AddressOf AutoLoad) autoLoad1.Start()
[CODE]...
Itemlists is a global lists i retrieved from database, everything looks fine to me but when i run this program, I found that the threads are inserting one records 9 times into the database(I have 9 threads in total), which makes me think that maybe i need to specifically assign 1/9 of a list to each thread? Is there another way to do it which doesn't require the splitting of the list, if not , how do i split it then assign?
I was working on an app that calls a batch file to do some simple tasks and found out this machine has some issues when trying to run them. really weird! so i did some testing and here are my resultsthis is a little strange to me and i can't think of why this is happening... let's say i have a simple bat file called test.bat these are the contents
@echo off echo testing... pause
When i go to run this bat, this is the output: C:>â– @ 'â– @' is not recognized as an internal or external command, operable program or batch file. It seems every bat i make on this machine is being preempted by the block character which renders bat files useless...
What I would like to do is read this data in as fast as possible either line by line and processing the data as I go by line. Or read the whole lot in and THEN process it, which woulkd be the fastest ? I used to do this in Excel but want to transfer it to VB and don't know really how to get started I have the following but would like to know how to get the columns into a named array and then how to itterate through array.
Dim myLines() As String = IO.File.ReadAllLines("C:SYNC_DATA�0 - LGW�5 - Archived�0 - IST Logs2008istlog20090224.txt")
im trying to write a queue window for an app... here is what i need to happen.on the form:4 listboxes that aren't visible to the user, 1 column each 1 listview with three columns: type, output file and status 7 buttons including: start, pause, abort, remove, open, save and clear when the user clicks start i want it to process all the items that are marked as ready in one of the listboxes, lstStatus.i was doing this with...
Dim count As Integer = lstStatus.Items.Count() Dim ready As String = "Ready" Dim i As Integer = 0 If count > 0 Then
[code].....
lstCommandLine is another one of the listboxes. i need to get the index of the lstStatus item that the loop is working on now which i will store in i. ill need to change the listview subitem from ready to complete and the lstStatus item from ready to complete as well. im guessing that would be in the same loop.
the hex convert code seems to work etc but it freezes but it does its job eventually I read that backgroundworkers can be used to fix this issue but I have no idea how to use it for my script
I got a question on sql splitting a record into peaces.I got a big record like this and all of this in one piece of record:
" 5/21/2009 1:03:49 PM Order has been placed 5/25/2009 1:45:49 PM
[code]....
This is used for making notes, so you can keep adding notes on it until it's done.And I know this is not the 'best' way of keeping these records, this is the way how it was kept until now.So now my manager comes to me and asks to make a different structure of processing these notes.Because it is stored this way I can only retrieve full record from the database, but what I need is a way how to take for example only the 'top line' of it.Example:5/25/2009 8:45:49 PM Confirmation send
I am a Real Estate appraiser and have some limited experience with vb and .net. I have a task which I perform which requires me to go to the conuty appraisers web site and print a copy (to image bmp or jpg or directly to the default printer) of the current public record info for anywhere from a few pages to 1,000 plus records at a time.
I don't really get paid to do this part of the job so they don't care whether it takes me a few minutes or several hours to do this. I thought there must be a way to automate this process, so last week I started searching and test code snippets.What I have to date opens an instance of IE; navigates to the reguested page; finds the form elemet for AcctNo; fills it in and submits the form. The page that comes back is formatted for screen presentation and is not suitable to be sent to the printer. There is however a link which when clicked returns a page formatted for pinting. Downside is it also brings up the print dialog which then has to be handled. I was able through several methods to click either the print button or the cancel button which leaves me with a document that is either sent to printer or sitting on screen.
The questions are: Is there a way to do this without displaying the Print Dialog? Maybe a HTTPRequest or HTTPWebREquest as I have no need to see the screens just need the final page.The resultant page is typically longer then letter by a few lines and wants to print on two pages. It would be nice to resize the page to fit and typically it will be the same resizing. If I stick with the print dialog either clicking print or cancel how can I intercept the document and decide by options set in the program wheter to send the file to the printer or save to image?
I'm trying to use a java servlet in a 3rd party tool's web interface (CA service desk) to invoke it's download file functionality using a webclient in vb.net. The trouble is the text stream from response is markup and not the acutual text file stream.
It's like the page is redirecting to another page which actually presents the file for downloading. I have no idea what the redirected page URL is.
Is there a way I can process this redirected page in order to get at the download using a system.net.webclient?
nutty VS2005 error. I know I have an error in my dataset file (XSD file), but none of the errors listed after this warning message truly points to the source of the problem. In the past, when my dataset had only a few tables, it was easy to find the error. Now I have 50+ tables. I'm not sure where to start.
Rather complicated question here. I am improving the text coloring in my custom RTB ontrol, and it is pretty simple:Quote:1. Disable drawing (SetDrawing(False))2. Get current selection 3. Select lines to colorize4. Process selection RTa Font object.
I am creating an application for learning purposes. I am using this: process.start("iexplore.exe"); That is working fine. However I would like to be able to tell when the page has been loaded all the way. I would like to know how to tell if the application is done processing or not, that is my main goal. If using the webbrowser control you can use the webbrowser documentcompleted event.
what im trying to do and what i have done so far is probably a little backwards not sure sure how to id it any other way.when the user generates an error because a particular file doenst exist ive got my dialoge box to generate an .txt file for each file it errors on, so that the administrator can check and update missing files as an when - shouldnt be many files missing in the first place, should just be new product ranges or item just launched.what im stuck on is:
1. is there a better way
2. how do i open a .txt file and add the extra lines to it, so i re use the file but keeping the previous data.
as seen in picture I have in "TextBox1" some numbers and I would like to have a detailed information on "TextBox2" (marked with red) when I pressed the "Process" button about them. In other words, I want the application to tell me how many numbers in total are inside "TextBox 1" and also to tell me if there are some duplicated numbers if it finds some of course?
I wish to add a progress bar in code. I have a sample here but with the "Cursor.Current = Cursors.WaitCursor" to notify the user that it running.. however a progress bar maybe can make it more noticeble. how can i do that.
Private Sub CmdOK_Click(ByVal sender As System.Object,
I use a SqlDataAdapter to fill a DataTable and then set that DataTable as the DataSource for a DataGridView. All works well. Then I add a column at the beginning of the DataGridView that will allow a user to check/uncheck a row for further processing. All works well. Then I display this to the user. All works well.
Since there are many times when the DataGridView could be displaying hundreds or maybe thousands of records, I have a button that will "Check All" records and another that will "Clear All" records. These work fine, but I've noticed a serious performance lag. Other test code that I've got shows that in an unbound DataGridView, even a large one with 50+ columns and 5000 rows, checking or unchecking all of these fields takes mere fractions of a second. (One test with 50 columns and 50,000 rows still only takes 0.334 seconds to check all of the rows.)
In my testing (with my current code), checking/unchecking 500 rows takes 15 seconds. Is this because the DataGridView is databound? If so, is there a way to UNbind it (making it simply a stand-alone set of data)? I don't need to push updates back to the server, so there's no danger in removing any databinding. I've even toyed around with this (to make the DGV unbound):
I have an app with 4 buttons that each generate a random number into textbox, before this number is entered i would like to have a progress bar at the bottom, well show that its processing basically.
In Form1 there are a lot of boxes like checkbox, label....I want to show a processing message for opening serial port after program running. So I created Form2 specifically showing "Opening Port...". So in Form1_Load() I used Form2.Show(). However this message showed behind of Form1. I think this was executed before all the other tool boxes loading. So where should I put Form2.Show()?
I am trying to copy the values to another sheet but not in any sequence eg.A1,B2,C4,D7 ........and so on. I am trying this slick way of doing it by the code below ( found on the web) without success so far but I got a feeling I am close to the solution. I am new to any kind of Programming. This is my first attempt. (so a chuckle or two is ok after seeing my "difficult" problem)
(This is an excel VBA Prblem) Sub justdoit() Dim s As Variant
At the moment, my project has a method do_job(jobid,userid)
This method take a minute or two, and then redirects to another page. This has been rewritten so that it now runs in the background and redirects to another page whilst the thread which do_job is on continues. - This works fine. In a button_click event in a default.aspx page :
Dim d as New do_job_delegate(AddressOf do_job) d.BeginInvoke(jobid,userid, New AsyncCallback(AddressOf Callback),d) Response.redirect("results.aspx")
[Code]....
So what i want to happen is - the longest time that do_job takes is the longest time of the longest job (30 seconds), rather than - 30 seconds x number of jobs = time it takes at the moment.
As i'm already using a delegate to detact the process from the ui, can anyone provide any advice/best practice on how i should rearrange my do_job method so that it can handle concurrent tasks to further boost the overall speed.
If vb application (windows form app) is calling a store procedure and it takes 5-10 mins to SP to finish and meanwhile the application is (forced to) close,
what will happend at the SQL side?
Will the proc completely run even though the app is not running anymore?