VB 2010 - Multithreading - Missing Some Data That Is Streaming
Nov 24, 2010
I am developing a software that catches streaming data. Unfortunately, there is no pattern or sequence on how this data comes in. So what I have initially done is to catch then write to my MS Access DB. Unfortunately, while writing to the DB, I am missing some data that is streaming since writing takes a little bit of time before it goes back to the catching syntax.
I am planning to multithread the DB writing then just call it from my main program. Do guys know any website/tutorial where I can learn the basics for multithreading? I am using Visual Studio 2010. Or if ever, does any one of you have a sample program where I can just learn from?
View 6 Replies
ADVERTISEMENT
May 6, 2010
I am working with a .csv file that is generated from a Java-based application. It mainly contains contact information. I can see the data when I open it in Notepad, Excel, and Access. However, when I attempt to read the data file in using the following code, I get blank data. I accidentally discovered that if I open the .csv in Excel and then save the file, my program will read it in perfectly.
MrWrightAZ
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:GAS_ReportMembership.csv")
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(",")
[code]....
View 1 Replies
Apr 2, 2006
I want to know how I can take a regular avi, mpg, wmv, etc... with out a streaming server or a streaming file, and not downloading the entire movie Play it with windows media player or a different media player, oreven a custom one.
View 2 Replies
Jul 31, 2010
I am using VB.net sockets to send a music file from one instance to another. It currently saves the file, but I do not want to be caught up in file-sharing, so I want to "save" it to a buffer, and when it gets to a particular percentage transferred, I want another thread to play the music file, deleting it from the buffer as it plays. I have the code to send it over the network, but I need to know how to keep it in a buffer and not save it as a file.
View 1 Replies
Oct 6, 2009
I am attempting to figure out the best way to place values into an array using dynamic data that is continuously streaming in from a ComPort. I want the array to hold 5 values at a time, with the newest incoming data point taking the place of the oldest data point. Each set of values in the array will be used in finding a trendline, which is then used in a later portion of the code.
View 1 Replies
Feb 8, 2012
I use the following code (with Imports Microsoft.DirectX.DirectSound and Microsoft.DirectX) to play sound using an 8 second static buffer:
Dim SD As Device = New Device
SD.SetCooperativeLevel(Me.Handle, CooperativeLevel.Priority)
Dim MS As New IO.MemoryStream(Gbuffer) ' Gbuffer is byte array with properly formatted WAV data
Dim waveFormat As New WaveFormat
waveFormat.SamplesPerSecond = 44100
[Code] .....
What I would like to do next is to change to a "circular" or "streaming" buffer so that I can write new data "on the fly". I've done a lot of Googling but can't quite see how to adapt my present code to use a circular buffer. I can get the current write and play positions using Msb.GetCurrentPosition(iPlayPos, iWritePos) but how do I actually insert new data into the buffer? I have tried "manually" writing new data into my Gbuffer byte array but that doesn't work - I guess once a sound has been played through once, the data is cached somewhere and the contents of Gbuffer are not used again.
View 7 Replies
Mar 7, 2012
I have 2 comboboxes who are loaded on the formload event with the folloving
[Code]...
View 3 Replies
May 11, 2010
I'm using the WIA Aut. Library [URL] , trying to capture photos from 5 digital cameras (Nikon D90) USB-connected to my pc. Now, I partially achieved my goal, what I do is:
- loop through the attached devices, connecting to every camera;
- fotocamera.ExecuteCommand (WIA.CommandID.wiaCommandTakePicture) ;
- other image processing operations...
Everything works fine but... the workflow is camera1 -> connect -> grab pic. => camera 2 -> connect -> grab pic. => camera 3.....
[Code]...
View 1 Replies
Feb 9, 2011
I just put a button and a textbox on a form to try and learn to multi thread, i think i've done it correctly. but it still appears to freeze for a little bit just before it attempts to display the data. i think it's the invoking. Is it normal / have a done something wrong?
[Code]...
View 2 Replies
Jun 10, 2011
Sub Main() Try'process i files on their own thread
[Code]...
I'm running into a problem when I stop the debugger, the console window stays open, and I can't kill it via task manager.
View 7 Replies
Apr 14, 2010
explain to me why the 1st example gives me an error complaining about cross thread yada yada....but the second doesn't, and works? this is inside a worker thread function
[code...]
I understand the concept of needing delegates and all that jazz when working with multiple threads, but why give me an error if there's no invoke required anyway?
View 4 Replies
Jan 19, 2011
I have a List(Of Byte) that is filled with bytes from the serial buffer on a SerialPort.DataRecieved Event. I then try to parse the data. Part of the parsing process involves deleting elements of the List(Of Byte). Should I be concerned about the List being modified by a DataRecieved Event that might be raised during the parsing process? I realize that probably depends on what I'm trying to do, but, assuming I should be concerned (e.g., the parsing process needs List.Count to not change until parsing is finished), how should I go about making sure any Add calls wait until the parser is done? I guess the answer is something like SyncLock, but I've never really understood how SyncLock works.
View 1 Replies
Jul 30, 2011
I'm trying to execute a sub with multiple parameters on a separate thread, but I just can't get it to work, Here's my code
[Code]...
View 2 Replies
Dec 1, 2011
I am building a code library to be used by a 3rd party developer. Neither my code or the 3rd party have any UI controls involved. It's purpose is a combination of providing the ability to look up information from a database while at the same time polling it and throwing events when a set of conditions are met. Naturally the only way it's going to be responsive to the 3rd party library's commands is via multithreading since everything in a single thread stops once you start polling the database.
The sub I am using is part of an object that I create in the main thread and attempt to have it run via a thread, when a condition is met I have it update a property in that object, throw the event (or execute a callback in my latest attempt) and then attempt to have a simulator for the 3rd party control read the property.It's easy to setup the multithreading part, the hard part appears to be throwing the event so it is seen in the original thread and the data is available there. Any attempt to do this generates a cross thread error when the data is read.
I attempted to use delegates and calling methods asynchronously and using the callback function but still get cross threading errors.Is my only possiblity to use a background worker, using either the progress changed or runworker completed events? Even then am I going to be able to set the property in the function from one thread and read it in another?
View 1 Replies
Mar 1, 2011
I'm writing a really simple file updater which downloads files off from a website and saves them. The download routine is working well, except that it freezes the project while attempting to connect to the host. Easily solved with threading except now when I try to access other form items such as text boxes, labels, form caption, it says I am not doing it in a safe manner and prompts an interrupt in debug. I did some reading on it and I'm still not sure what to do, I'm very new to vbnet and it is still a little confusing to me.
Error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.
Imports System.Threading
Imports System.Net
Imports System.IO
[code]....
View 8 Replies
Feb 24, 2012
I've got 4 projects all running very similar multi-threading HTTPListener stuff.I wanted to make these functions common - in some module - but I'm having a hard time getting the AddressOf the "callback" passed in.This was the code in one of the 4 projects
Private Sub StartRequests(ByVal prefixes() As String)
If Not System.Net.HttpListener.IsSupported Then
DisplayInfo( _
[code].....
View 1 Replies
Oct 30, 2011
The error occurs at: For i As Integer = 0 To txt_load.Lines.Count - 1..The project exists of 2 rtb's. One with a list of lines. The other will be filled with the converted lines. The main reason that I use it is that I want to use the app during the conversion. The second is that I want to learn how this works.[code]
View 9 Replies
Jun 4, 2011
Right now I have a Email class that has all the properties of an email to send it, and then a SendEmail function which takes those properties and uses them in the following
Public Function SendEmail()
'Exception handling
Try
[Code]....
The loop goes through each email in the array to process its email, however with the multithreaded function I cannot call
"EmailArray(i).ThreadSendBatchEmail()"
So how do I call an objects method when its on a different thread?
And I'm making it multithreaded so I can easily pause the process, and because the program freezes when the send() function is working, this would resolve that.
View 17 Replies
Mar 28, 2012
I have a DataGridView that I'd like to load with data that I'm retrieving from a SQLDataReader running in a background worker as the data comes in (it's a query that takes a long time). My goal is for the user experience to be similar to searching for a file in Windows where the results appear in the list as they come in and you can still interact with the window.
I have it working with a background worker and data reader and I'm trying to add the row from the SQLDataReader.Read through using the BackgroundWorker.ReportProgress method. Everything technically works but the flicker is crazy and the form is unusable (probably not because the GUI thread is blocked but just because there's so much going on...) How do I make loading the datagridview "smooth"?
View 1 Replies
Jun 21, 2012
I have installed VB.NET express 2010 version and I am trying to create a new dll file for use in my SSIS packages. When I try to write the code, the VS environment tells me that I dont have the Microsoft.SqlServer.Dts.Runtime Namespace. What can I do to make this possible?
I looked around on internet but couldn't find anything substantial. I also have BIDS 2008 which I use to create packages. I cannot uninstall that because I have some work to do on a daily basis.
View 2 Replies
May 20, 2010
Where did this Data Source window go? How can I get it back? I just upgraded to VS 2010. [URL]
View 5 Replies
May 12, 2010
what is the fasted way to get all the rows from table1 that aren't in table2? i have over 4000 rows in table1, i am currently looping through using:
for each dr as datarow in dt1.rows
then i check table2 to see if that entry exists using:
dim rows() as datarow = dt2.select("EmployeID = " & dr!EmployeeID)
if rows.length > 0 then it exists in both tables - dont need it
other wise i copy the row into a third table which ends up being my final collection of rows that are in table1 and not in table2. this takes a really long time. is there a better, faster way that isn't too complicated?
View 4 Replies
Dec 30, 2008
I've set up a stream reader to get data from a serial file, functionality for that is already set up.
My problem is that the program seems to be missing out every other line of code in the file, which kinda defeats the point of a serial file. [code]...
View 2 Replies
Feb 3, 2011
When I build my project I get a compile error stating "Could not locate the manifest signing certificate in the certificate store". This is a new one to me and I have no idea how to solve it.
View 1 Replies
Feb 6, 2011
I want a button that when you click at it, It searchs for a line that has brackets that are'nt closed, and then ighlights the error.Like, I have; So the (Dog Which should be for example (Dog). Then, I want it to highlight it so the user can see his error, and show a notifyicon on it.
View 4 Replies
Sep 14, 2010
I have a class library that is referenced by several other class libraries along with the main program. About two weeks back, I made a change to one of the classes in that base library, which is used as an argument for some events. Since that time, I have been testing code. Today, after a couple more tests, I started getting this exception. It is indicating a field is missing, which was renamed in that change about two weeks ago. The exact code that is raising the exception is code that I have run a couple dozen times in the intervening time, and it has always worked.I have tried everything I can think of, including deleting the bin and obj folders of every module that could be in any way related to this issue, such that the whole thing was rebuilt. I have removed the references and re-added them. Nothing worked. Code that has run fine for weeks has decided that it wants a version of an object that has not existed for weeks.
This problem arose immediately after a different problem, so the two might well be related. The other problem was that, while stepping through code, the IDE decided that one of the code pages was different from when it was last loaded. I get that a fair amount, and solving it is fairly routine. It generally means that I am stepping through code in a dll, and inadvertently tried to fix a bug in that code, rather than in the dll itself. Now it no longer matters. I can't get to that code page, nor can I get to anything else in that dll. It is acting like it has sponaneously decided to revert two weeks back in time, and use that source code for debugging, despite any attempt I make to bring it up to modern times.
View 1 Replies
Jun 5, 2011
I'm working on a grid of cells that is something like a DataGridView, but not really. The two are close enough that you can picture a DGV for the purpose of this question. What is actually there (and this is true for actual DGVs) is a set of cells drawn on the screen with a couple scrollbars for vertical and horizontal scrolling which are only drawn if there is too much data to show in the visible cells. There aren't more cells than the ones that are visible, so when you scroll the scroll bar, it looks like new cells are being displayed, but what is actually happening is that the existing cells are just being filled with different data depending on the position of the scrollbar. The key observation is that the set of controls displayed in the grid is always the same (unless the grid is re-sized, but that's not relevant to this issue). The appearance of those controls can change, but the controls themselves do not.
One of the features I am adding is the ability to drag-copy data similar to how Excel works. In my case, if you click on a cell, then drag outward (move the mouse while holding the button down), all the cells in the selection rectangle are tinted green. This works nicely. Some of the cells are enabled, while others are disabled. If the drag selection includes disabled cells, those are not tinted. Only enabled cells can be selected, though a drag can cover disabled cells. The relevant point here is that some cells are enabled and some are disabled.
The feature that I am adding is the ability to do drag selection beyond the visible edge of the grid. The grid is a monthly calendar, and I simply can't get 31 cells onto even a wide-format screen. What I am trying to do is allow the user to do drag-copy onto days that are not currently visible. The way I do this, the user clicks in a cell, then drags out to the border, at which point the grid scrolls (the scrollbars move, and the contents of the cells is updated as a result of the changes to the scrollbar value). This is largely working.
The way I handle the selection is that when the user presses the mouse button while over a cell, a flag is set to indicate that the button was pressed, and the current cell is recorded (so that I know where I started from). MouseMove events are used to figure out what new cells the user has visited, and set the selection area based on whatever is under the rectangle described by the initial click point and the current point. Lastly, when the user releases the mouse button, the MouseUp event initiates the actual copy. At that event, I know that the user is done with that copy action. Therefore, the MouseUp event is kind of critical, and therein lies the problem.
As I mentioned, some of the cells are disabled and some are enabled. Disabled controls don't raise events. If I click on a cell, it HAS to be enabled, but that's fine. The problem is that if I then move the mouse in such a fashion that the grid scrolls such that the cell that I had initially clicked on is no longer enabled, then the cell doesn't raise events any more, and the MouseMove and MouseUp events stop happening.I only see one viable solution, which is to not toggle the enabled state of the grid cells. Instead, I would have to have to add a custom property that would make the control act and look disabled as far as the user was concerned, but it wouldn't be disabled as far as the program was concerned such that it would keep raising mouse events. This would be pretty rough, since I would need to prevent the control from appearing to have focus even though it technically would have focus
View 11 Replies
Nov 1, 2006
If you are creating a new adapter, drag a data adapter object from the Toolbox onto a form or component.
I cannot find Data Adapter object anywhere in the toolbox. I assume it would be under the Data grouping, but it is no where.I also "Reset ToolBox" and it is still not there.
View 3 Replies
Aug 6, 2011
I have manage to take print of the contents of datagrid but now i have one problem when i click on print button it prints the document very fine but The headings of the all columns is not printing here is my code what changes should i made to resolve the issue here is my print class
< Imports System
Imports System.Text
Imports System.Collections
[Code].....
View 2 Replies
Jan 30, 2012
I'm working on a project which involves communications with a remote device via a modem. Communication is accomplished via HEX commands. However, with my code below, I am not receiving zeros where they are meant to be.For example, a test file contains the following HEX:
010203040506070809
However, I am only receiving this:
123456789
The zeros are critical.
Private Sub receive_data(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Dim buff As String
Dim i As Short
[code]....
View 3 Replies