Click here to Skip to main content
15,881,852 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to delete file from FTPS server (using LibCurlNet) Pin
Johan Hakkesteegt28-Mar-14 0:51
Johan Hakkesteegt28-Mar-14 0:51 
AnswerRe: How to delete file from FTPS server (using LibCurlNet) Pin
Dave Kreskowiak28-Mar-14 4:13
mveDave Kreskowiak28-Mar-14 4:13 
GeneralRe: How to delete file from FTPS server (using LibCurlNet) Pin
Johan Hakkesteegt30-Mar-14 20:07
Johan Hakkesteegt30-Mar-14 20:07 
QuestionUsing matlab fuction in VB 6 Pin
azhari2428-Mar-14 0:16
azhari2428-Mar-14 0:16 
AnswerRe: Using matlab fuction in VB 6 Pin
Dave Kreskowiak28-Mar-14 4:14
mveDave Kreskowiak28-Mar-14 4:14 
Questionform resources vs project resources Pin
dilkonika27-Mar-14 2:19
dilkonika27-Mar-14 2:19 
AnswerRe: form resources vs project resources Pin
Nicholas Marty27-Mar-14 2:53
professionalNicholas Marty27-Mar-14 2:53 
QuestionSynchronizing raised events to UI thread possible? Pin
Sam Marrocco24-Mar-14 11:40
Sam Marrocco24-Mar-14 11:40 
I written a ProcessUtility class that allows me to call a process (which in turn runs a commandline executable) asynchronously. The process then raises events indicating completion, progress, etc.

When the ProcessUtility class is set up from the UI form as:

dim WithEvents P as ProcessUtility_Class
P.Start

All runs as expected. Events are raised appropriately and, as expected, they are on a different thread from the UI and calls to the UI controls must be invoked to avoid cross-threading errors.
I've been reading up on async, synchronization contexts and other threading concepts to better understand the issues. While I can (and have) wrapped every UI call within the events, it seems very redundant to have to do it every time a UI element is utilized. Since the problem isn't really the UI, but the Asynchronous process that is raising events in the "wrong" thread to the UI, it seems that there should be a (better) way to have my ProcessUtility class raise it's events within the threading context of the UI (if desired). That way, only the few events are specialized and whatever happens within them is UI-threadsafe. Perhaps something along the lines of (pseudocode):

ProcessUtility_Class
Public Event Process_Started(ThisProcess as sender, SecondArg as string)
Public sub Start(Form1)
Form1.StartInvoke 'Everything from here until endinvoke happens within the MyForm thread
RaiseEvent Process_Started(blah, blah)
Form1.EndInvoke
DoStuffAsynchronously
End Sub

Is there something like this that can be done that the raised events are always running in the context of the main form that created the ProcessUtility_Class object in the first place? My goal is to avoid having to continuously wrap every UI call with delegates and invokes.
AnswerRe: Synchronizing raised events to UI thread possible? Pin
Bernhard Hiller24-Mar-14 22:18
Bernhard Hiller24-Mar-14 22:18 
GeneralRe: Synchronizing raised events to UI thread possible? Pin
Sam Marrocco25-Mar-14 7:33
Sam Marrocco25-Mar-14 7:33 
AnswerRe: Synchronizing raised events to UI thread possible? Pin
Eddy Vluggen26-Mar-14 8:24
professionalEddy Vluggen26-Mar-14 8:24 
QuestionQuestions about SMO Pin
dilkonika24-Mar-14 2:57
dilkonika24-Mar-14 2:57 
AnswerRe: Questions about SMO Pin
Chris Quinn24-Mar-14 3:30
Chris Quinn24-Mar-14 3:30 
GeneralRe: Questions about SMO Pin
dilkonika24-Mar-14 4:02
dilkonika24-Mar-14 4:02 
GeneralRe: Questions about SMO Pin
Chris Quinn24-Mar-14 4:05
Chris Quinn24-Mar-14 4:05 
GeneralRe: Questions about SMO Pin
dilkonika24-Mar-14 4:08
dilkonika24-Mar-14 4:08 
GeneralRe: Questions about SMO Pin
Chris Quinn24-Mar-14 4:10
Chris Quinn24-Mar-14 4:10 
GeneralRe: Questions about SMO Pin
Chris Quinn24-Mar-14 4:14
Chris Quinn24-Mar-14 4:14 
GeneralRe: Questions about SMO Pin
Eddy Vluggen24-Mar-14 8:13
professionalEddy Vluggen24-Mar-14 8:13 
QuestionZedgraph YAxis Bit Values with Text Labels Pin
Member 224024223-Mar-14 22:22
Member 224024223-Mar-14 22:22 
QuestionVB.NET aximp.exe not found Pin
CharlesDE23-Mar-14 21:20
CharlesDE23-Mar-14 21:20 
AnswerRe: VB.NET aximp.exe not found Pin
Bernhard Hiller23-Mar-14 22:00
Bernhard Hiller23-Mar-14 22:00 
GeneralRe: VB.NET aximp.exe not found Pin
CharlesDE23-Mar-14 22:32
CharlesDE23-Mar-14 22:32 
QuestionIdentifying process completion Pin
Sam Marrocco23-Mar-14 10:26
Sam Marrocco23-Mar-14 10:26 
AnswerRe: Identifying process completion Pin
Alan N23-Mar-14 11:02
Alan N23-Mar-14 11:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.