Message 1 of 36
Wait for SendStringToExecute to complete
Not applicable
05-20-2009
09:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I figured out a method to wait for the SendStringToExecute to complete. It's similar to using a WebService, i send my command and subscribe to an event and complete my function when the command completes.
What i did was make a command that raises an event so i can just append that command onto any of my SendStringToExecute's
{color:#0000ff}
Public Event{color} eCommandComplete {color:#0000ff}As{color} EventHandler
<CommandMethod({color:#ff0000}"CommandComplete"{color})> _
{color:#0000ff}Sub{color} CommandComplete()
{color:#0000ff}RaiseEvent{color} eCommandComplete({color:#0000ff}Nothing{color}, {color:#0000ff}Nothing{color})
{color:#0000ff}End Sub
{color}Then my other command goes like
<CommandMethod({color:#ff0000}"SomeCommand"{color}> _
{color:#0000ff}Sub{color} SomeCommand()
{color:#339966}'Do Some Work
{color}{color:#0000ff}AddHandler{color} eCommandComplete, {color:#0000ff}AddressOf{color} SomeCommand
SendStringToExecute({color:#ff0000}"Zoom E CommandComplete "{color}, {color:#0000ff}False{color}, {color:#0000ff}False{color}, {color:#0000ff}False{color})
{color:#000000}{color:#0000ff}End Sub
{color}{color}{color:#0000ff}
Sub{color} SomeCommand({color:#0000ff}ByVal{color} sender {color:#0000ff}As Object{color}, {color:#0000ff}ByVal{color} e {color:#0000ff}As EventArgs{color})
{color:#339966}'Do Some other Work
{color}{color:#0000ff}End Sub{color}
What i did was make a command that raises an event so i can just append that command onto any of my SendStringToExecute's
{color:#0000ff}
Public Event{color} eCommandComplete {color:#0000ff}As{color} EventHandler
<CommandMethod({color:#ff0000}"CommandComplete"{color})> _
{color:#0000ff}Sub{color} CommandComplete()
{color:#0000ff}RaiseEvent{color} eCommandComplete({color:#0000ff}Nothing{color}, {color:#0000ff}Nothing{color})
{color:#0000ff}End Sub
{color}Then my other command goes like
<CommandMethod({color:#ff0000}"SomeCommand"{color}> _
{color:#0000ff}Sub{color} SomeCommand()
{color:#339966}'Do Some Work
{color}{color:#0000ff}AddHandler{color} eCommandComplete, {color:#0000ff}AddressOf{color} SomeCommand
SendStringToExecute({color:#ff0000}"Zoom E CommandComplete "{color}, {color:#0000ff}False{color}, {color:#0000ff}False{color}, {color:#0000ff}False{color})
{color:#000000}{color:#0000ff}End Sub
{color}{color}{color:#0000ff}
Sub{color} SomeCommand({color:#0000ff}ByVal{color} sender {color:#0000ff}As Object{color}, {color:#0000ff}ByVal{color} e {color:#0000ff}As EventArgs{color})
{color:#339966}'Do Some other Work
{color}{color:#0000ff}End Sub{color}