VS 2008 : Making Safe Crossthread Calls?

Mar 13, 2012

Imports System.Threading.Thread
Imports System
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.demoThread = New Thread(New ThreadStart(AddressOf Me.ThreadProcSafe))

[code]....

I've been trying to use Microsofts example on their MSDN but I'm getting this error. :

Error1'demoThread' is not a member of 'WindowsApplication1.Form1'.C:UsersAydinAppDataLocalTemporary ProjectsWindowsApplication1Form1.vb89WindowsApplication1

View 20 Replies


ADVERTISEMENT

Win32 API - Equivalent To Making System Calls Abd And Library Calls In UNIX?

May 8, 2010

What the Win32 API is? I have looked around but no where really outlines what it is. Is it basically a set of procedures, outlined by Microsoft for programmers in order to get services from the operating system? In essence is it the equivalent to making system calls abd and library calls in UNIX? And yes I now Windows makes library calls too.

View 2 Replies

VS 2008 Making A List Thread Safe?

Aug 26, 2009

I am using WCF to make a chat application - I dont think the fact I'm using WCF is relevant for this particular question but just thought I would mention it in case there is something special about the way WCF does threading that I dont know about.So I have my WCF service that runs on a server and a WPF app that acts as the WCF client - each time a new client signs in or out it updates the server WCF service to let it know that it has changed status. The server then updates a list to either add or remove the user, so this list basically represents who is online at any one time. The list is declared in the core server class like so:

vb.net
Private Shared List(Of ChatUser)

So, I have a method in my server side that is called whenever a user needs to be added to this list and originally I thought I could have some issues because while the server might be looping through this list to find out who is online, another user might have signed out and the list would therefore be modified while the server was looping through it which would cause an exception. So I added the following to the start of the method that removes a user from the list:

vb.net
SyncLock New Object

and I havent had any problems... but I'm still not totally convinced that this will completely solve the issue. So would creating a Property give me a bit of extra safety? Assuming I always used the property to access the list in my code.
Like this:

vb.net
Private Shared Property CurrentClientList() As List(Of ChatUser)
Get
SyncLock New Object

[code].....

Also, am I actually using SyncLock correctly? I mean should I be referring to a shared object that all of the threads can access rather than just doing New Object each time or does it not make a difference?

View 9 Replies

Thread Safe Calls On Forms Controls Array

Jun 2, 2012

I am trying to access a dynamically generated Control from a separate thread. But I am always getting a "Stack Overflow Exception" with my code. I am using following code:

[Code]...

View 1 Replies

How To Make Thread-safe Calls To Windows Form Controls

Sep 20, 2011

[URL]

In my program, I created a list of a class that contains 5 picture boxes, a button, a label, an identifier, and some other stuff. I've got roughly 65 of these in this list. I'd be stupid to hard code all that in. The identifier is a 2nd way of identifying which specific location I'm working on.

Anways, all this is created at compile time. Works perfectly fine.

I then manually start a background worker that pings a collection of components. Based off the success of those pings, the picture boxes are enabled or disabled. Basically a proactive way to see if a collection of devices over multiple locations are actually working.

It's the background worker that fails because of thread-safe calls.

Private Sub bgwStatus_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgwStatus.DoWork
Dim status As Integer

[Code].....

View 1 Replies

Winforms - .NET 2.0 - StackOverflowException When Using Thread Safe Calls To Windows Forms Controls

Sep 22, 2011

I have a Windows Forms app that, unfortunately, must make calls to controls from a second thread. I've been using the thread-safe pattern described on the [URL].. Which has worked great in the past.

The specific problem I am having now: I have a WebBrowser control and I'm attempting to invoke the WebBrowser.Navigate() method using this Thread-Safe pattern and as a result I am getting StackOverflow exceptions. Here is the Thread-Safe Navigate method I've written.

[Code]...

View 1 Replies

VS 2008 CrossThread Operation - Create A Thread That Load A Function?

Mar 27, 2010

i create a thread that load a function, in this function i need to read from txtbox into the same form and during the function write into another textbox the call to function is done in this way Dim t As Thread t = New Thread(AddressOf Me.myFunction) t.Start() from myFunction i read info in this way myInfo = textbox1.text and i write into textbox during the execution of myFunction in this way textInfo.text = myInfo but in debug time i have an error of crossthread.. how can i solve this problem??

View 4 Replies

Replacing DbTransaction Calls With Calls To TransactionScope?

Mar 4, 2010

I have been using DBTransaction for my current projects that access a single database. However, I read some documentation on TransactionScope and was wondering in which scenario would using TransactionScope be better? Or should I be replacing DbTransaction calls with calls to TransactionScope?

View 2 Replies

Visual Studio 2010 - Crossthread Operation Not Valid

Feb 10, 2010

I am using vb.net, and in my program I get this 'crossthread operation not valid' error when I run my backgroundworker that will make this textbox enabled true. My main sub will first turn the enabled to false, and when the backgroundworker runs it will turn it back true then exit. Why does it give me an error? FYI: There is more code to this but I don't want to make it any more confusing... Here is the stack trace:

[Code]....

View 4 Replies

Illegal CrossThread Invalid Operation Exception On Form.Invoke()

Sep 12, 2009

Got a proccess thread thats in charge of loading a listbox full of the first line of text for richtextbox items on form load. Though I use Me.Invoke(New MethodInvoker...) to add items on the main thread so its thread safe it coughs when the first line of rtf data are thrown at it, acting as if I hadnt called adding the items on the main thread.

Up at the class level:
Dim Worker As System.Threading.Thread
In the load procedure for the form:
Worker = New System.Threading.Thread(AddressOf WorkerDo)
Worker.Start()

[Code]....

I"ve also tried to remedy this using a delegate to invoke the listbox before attempting to update it, but the invoke method itself is throwing the exception. I am not using the default instance of the form (a new instance of this form is created). Anyone know how I can get around this? I can't load the listbox full of items directly in the form's load procedure because work takes place in the thread beforehand so there are strings to add to the listbox. I've got MS Visual Studio 2008 Pro and Vista SP2 (latest updates applied).

View 7 Replies

VS 2008 List (Of T) Is Thread Safe?

Sep 5, 2009

On the MSDN docs for the generic List(Of T) class, it says this:

Quote:

Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.but I'm trying to work out what exactly that means or why it matters. Does that mean that if I had this:

vb.net
Public Shared MyList As New List(Of MyClass)

then I could enumerate through that list from several threads at once without there being a problem? I thought you could read from any object from multiple threads without a problem anyway... I thought it was only if there were potentially other threads modifying that object at the same time that there were problems. Particularly with a collection like a List because you cant modify a list while another thread is enumerating the items in the list as you get an exception thrown stating that the collection has changed. I think basically what I am asking is if the MSDN doc said that a public shared list wasnt thread safe then what difference would it make?

View 5 Replies

Microsoft VB 2008 Email Sender Not Safe?

Dec 13, 2009

if people wanted to sign up for a email sender they can enter there email into my form i created with VB and it would send that info to my email... well it turns out that they could get my password and i then got my email password hacked... how is this possible is it because i did not encrypt my form and they decrypted my form to get my email and password info? please tell me how this is done so i can be safer next time

View 3 Replies

VS 2008 - Is It Safe To Delete RESX Files?

Mar 20, 2009

I have a Visual Basic project in Visual Studio 2008. Do I need to keep the .RESX file that seem to be associated with each of my forms?

View 2 Replies

VS 2008 - Safe Cancellation Of Unknown Threads

Jul 7, 2011

I have got my multi threaded application running which is a Windows Service Project.

Basically when the service starts it starts a thread listening on a port for connections. The reason I started this on a new thread was so I could easily control it and not lock up that main worked thread.

Now on that thread when a client connects it dynamically assigns them another port number that is not currently in use and starts a new thread listening on that port and waits for the client to connect to do the actual data crunching.

So basically I have my main project thread, a Main listening thread then the possiblity of 0 to 100 more threads for each connected client.

Now this project should always be running but in the event it needs to be shut down (or server rebooted etc) I want to be able to shutdown the threads safely.

I can down my main listening thread safely but my trouble is all those other possible threads. What I would like is if the service is called to stop I want any of those other possible running threads which would have an active connection to the client to send a simple command like 'STOP' then close the connection gracefully (MyConnection.Close) and end itself.

The only solution I can think of which I don't really want to do is have a global varible (StopThreads as Boolean) and after each command in the thread check that boolean and if its set to true jump to some code to do what I want and end the thread but there must be an easier way? Or is this the best way?

View 4 Replies

Use API Calls In 2008?

Nov 21, 2009

i want to know how to use api calls in vb.net2008. in visual basic 6.0. we can find the list of api calls in add in manager . in vb.net2008 how to find it..

View 2 Replies

VS 2008 - Log In With Email And Password And Make Keep Safe Items?

Jul 27, 2009

i have created this programme which is basically a keep safe programme, well it's not created yet anyway.so far i have coded the the log in page, so the user can log in with their email and password.Once they do it comes to a screen asking if they want to visit their 'keep safe' items, or, asking if they want to deposit a file in their 'keep safe'.This is the programme belowThe Reason It say's JMEsseneger, is because i had other plans for the login until i came to face the fact, that im not quite fluant enough in this language to understand it all

1) As soon as they hit 'sign in' it creates a passworded.zip folder somewhere on their computer (using the same password they enterd to login and would only create the file if login is successful)2)The "Open SafeBox" obviously opens the file directory 3)the "Add To SafeBox" will allower the user to browes their computer for a file that they want to add into the "safebox" with a simple select and a click of an "add" button

View 10 Replies

VS 2008 : Make An Invoke Or Safe Thread Call?

May 27, 2010

i got a background worker that has the following code in the do work.... one of the things i want to do is to add rows if theres none available ...but i got an error saying i need to do a safe call thread...i already read about it but im stuck i put control.invoke, but that gives me an error too saying Error1Reference to a non-shared member requires an object reference.what can i do to add rows safely?

vb.net
Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
If DataGridView2.Rows.Item(num).Cells.Item(0).Value = "" Then
Control.Invoke(DataGridView2.Rows.Add(1))

View 6 Replies

VS 2008 Disabling Safe Mode And System Restore?

Oct 25, 2009

Is it possible to prevent my program from being ran in Safe Mode and System Restored?

View 5 Replies

VS 2008 Capture .NET Remoting Calls?

Sep 22, 2010

We have a client server application that 650 users are using everyday. Lately they have started complaining about over all slow responses and slowdowns in normal application usage like searching, reporting etc.We are using .NET Framework 3.5 and .NET Remoting is the technology we have used for client connection to the server side. We can't remove that and use something else due to legacy application maintenance. We are using SQL 2008 R2 x64 on a very good server.We have gone though the basic steps of making sure that all the SQL side is ok everything is well tuned but we need to convenience the client that it is not the application but the database that needs to be regularly maintained by a DBA in order for it to run smooth due to the nature of the application making tons of changes and inserts in the database everyday.

Anyways I need to write some sort of module that can plugin into the .NET Remoting calls so it can log the normal usage of different methods on the server like;* How many times a remoting method is called* What params a remoting method is called with* How much time it takes to execute each remoting callIs there anything available in .NET Framework that can help me? I read something about .NET Remoting Sync but not too sure if that is what I need to use? If any can shed any light on the subject or nudge me in a right direction with some sample code, that would be great.

View 2 Replies

Made A Web Browser In VB Express Edition 2008 - Make It Safe And Secure?

Jul 30, 2009

i recently made a web browser in visual basic express edition 2008 for my family computer use purposes only. Id like to make sure that using my web browser and entering personal information on it will be safe. How can i make it safe and secure? Additionally i was wondering if id have to develop my own addons or if its compatible with Firefox addons.

View 1 Replies

VS 2008 Can Set Up A Series Of Calls At Application Load

Apr 15, 2009

I have a VB6 project that I'm converting to VB 2008. There is a routine in this project to LoadArrays.By passing the proc name and arrayName I want the info loaded into, I can set up a series of calls at application load and have these arrays available throughout the application (Info is used in many areas to populated controls)This routine makes use of Getrows.Example:arraydef = rs1.GetRows.This will load all fields and records into the array.Is there an equivalent in 2008?

View 1 Replies

VS 2008 Replacing API Calls With .NET Framework Classes?

Aug 18, 2009

Do we have nay .NET framework classes to replace the following API calls?

CreateWindowEx
GetWindowText
ShowWindow
SendMessage
GetWindowRect

Basically we have migrated our application from VB6 to .NET and used same API calls in .NET as well.

Now the time has come to replace all API calls to .NET framework classes.

We used those API calls to validate textboxes by popping up a temporary error message box next to textbox object. After few seconds, the error message box disappears by itself or on loosing the focus of textbox.

If we can use the similar functionality of .NET, then there will be less code changes

View 3 Replies

VS 2008 - How To Write Wrapper DLL For Accessing Function Calls

Jul 27, 2011

I have a camera for which the complete source code with header files(.h) and all libraries files(.lib) are given in VC++. Now if I want to access the function calls in the header files and in turn the functions in the library from VB.NET, I am required to write a wrapper DLL for accessing the function calls which I never did till now.

View 1 Replies

VS 2008 .NET Child Form Controls Method Calls?

Sep 14, 2010

I have a MDI Form that has a child form containing a text box. I want to be able to make a call to the TextBox's cut() method on the currentlly active child form. Here's what I have so far, but it is complaining about using ctrl.cut()

[Code]...

View 3 Replies

VS 2008 Built In Key Calls (Shift - Ctrl - Alt) Are Broken On Windows 7 Bit

Nov 23, 2009

VS 2008 Built in key calls (Shift - Ctrl - Alt) are broken on Windows 7 Bit

View 4 Replies

VS 2008 : Calling A Fortran .exe That Calls A File - File Not Found?

Jul 6, 2010

I am trying to run a fortran .exe in VB with the Shell() command. The fortran .exe, when ran, it asks you for a file name. It works perfectly on it's own, but when I try calling it through VB Shell(), it does not work.. (i.e. I cannot get VB to get the file name in it.)

Added info:I am using VB9 but I'm writing in compatibility to .NET. As for the Fortran .exe, when you call it, it opens a command window where it asks for a file name (which I got as a string in VB and I'm trying to pass it in), then you press Enter and it's done. Basically the .exe takes a text file and creates a new text file. We've also tried adding & mystring when calling the exe, but it gives a "file not found" error.

View 3 Replies

VS 2008 What Will Happen When 3 Function Calls Same Function At A Time

Apr 27, 2009

What will happen when 3 function calls same function at a time? I have 3 Function, f1,f2,f3.. Those function after completing their task will call finish() function. What will happen if Finish is Called morethan once..

View 9 Replies

Designing Software - Making A MPC Sampler - Drum Machine - Making A Sound Directory ?

May 16, 2012

I'm a huge music person (got my own lil record thing going) but I'm wanting to design a program that would make music in my way. I have a decent amount of background knowlege of Visual Basic and Java I'm just wondering how could I execute this whole project. The Project is making a MPC Sampler. MPC is a drum machine; a machine with buttons that once you press it that it will play a sound from a drum (ex: snare, kick, tom, ect.) . So I would want to make some pads on my program that each have their own sound. Total of 16 pads. Which the design wouldn't be hard to make nor would the functionality of it having the play back sound (in my opinoin it wouldn't be hard atleast). But the thing is I wanna map out these pads to number keys on the number pad or keyboard. I'm not so sure how to do that. But that's all the easy stuff...

Also finding information is making a sound directory. What I mean by this is that I want to make a User Interface that will open up a file directory of sounds and the user can select what "kick" or "snare" sound he may want for the kick or snare pad. I don't know how to do that or even know what to search; neverless I don't know if this whole project idea is a good idea for Visual Basic or another programing language.

Also LATER ON I am wanting to add a record and export function that alows users to..well...record and export their beat or instrumental ha. That doesn't seem too too complex (mainly due to the fact that all it needs to do is record the users key strokes and then show them and play the sounds, but obviously it would get more complex than that.)

Here is an image of one of many MPCs but one with a directory - [URL]

View 5 Replies

FAIL SAFE Way Of Getting A Favicon?

Oct 3, 2009

I have this protocol for getting a favicon: (I stole it from Thomas Maxwell, and adapted it, but still)

Public Shared Function GetFaviconSilent(ByVal IconURL As String)
On Error Resume Next
Dim oIcon As Icon

[code].....

View 6 Replies

IDE :: Disconnecting From Source Safe?

Feb 27, 2009

I am using VS2005, using VB.Net?I just created a local copy of a project on my drive. The original copy is being worked on by another developer.I deleted the .vspscc & .scc files?However, everytime I make a change, I get the message that the file is locked, and exclusively checkout by another developer. How can I make changes to the project, that I have copied to my drive. I need to disconnect it from VSS.

View 2 Replies







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