Click here to Skip to main content
15,894,410 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionMultiple timers accessing single class Pin
Doug.Aliff2-Apr-09 16:10
Doug.Aliff2-Apr-09 16:10 
AnswerRe: Multiple timers accessing single class Pin
Tom Deketelaere2-Apr-09 21:48
professionalTom Deketelaere2-Apr-09 21:48 
AnswerRe: Multiple timers accessing single class Pin
Mycroft Holmes2-Apr-09 22:04
professionalMycroft Holmes2-Apr-09 22:04 
GeneralRe: Multiple timers accessing single class Pin
Eddy Vluggen2-Apr-09 22:20
professionalEddy Vluggen2-Apr-09 22:20 
GeneralRe: Multiple timers accessing single class Pin
Jon_Boy3-Apr-09 2:23
Jon_Boy3-Apr-09 2:23 
AnswerRe: Multiple timers accessing single class Pin
Dave Kreskowiak3-Apr-09 9:26
mveDave Kreskowiak3-Apr-09 9:26 
GeneralRe: Multiple timers accessing single class Pin
Doug.Aliff4-Apr-09 16:43
Doug.Aliff4-Apr-09 16:43 
QuestionMysterious Error Pin
Dave_Lowe2-Apr-09 4:11
Dave_Lowe2-Apr-09 4:11 
Background: I have a class wrapping httpwebrequest/response and executing on it's own thread with an event handler for DataArrival.

I have 2 web addresses I can use. 1 is with test data and 1 is an internal site with the real data. If i run the code on the production machine the site will fail (since it's not on the internal network) but it works fine with the test site. When the internal site fails it just returns a webpage from opendns saying it can't find the site (which is what should happen), but for some reason it crashes the program.

ModemTests - is a string array holding the information coming in (currently only using index 0)
ShowModem - this is the sub where the data gets processed

Public Sub Modem_DataArrival(ByVal sender As Object, ByVal e As DataArrivalEventArgs)
        ModemTests(0).ModemInfo += e.RecievedData 'there is data in here when it crashes

        If e.IsComplete Then
            If ShowingModem = sender.tag Then
                ModemTests(0).ModemRunning = False
                Dim d As New SetTextCallback(AddressOf ShowModem)
                Invoke(d, New Object() {ModemTests(0).ModemInfo}) 'error occurs here
            End If
        End If
    End Sub


Crash error:
System.ArgumentOutOfRangeException was unhandled
  Message="Length cannot be less than zero. Parameter name: length"
  ParamName="length"
  Source="System.Windows.Forms"
  StackTrace:
       at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
       at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
       at ConnectionTools.frmMain.Modem_DataArrival(Object sender, DataArrivalEventArgs e) in D:\VS2008\WindowsApplication10\WindowsApplication10\frmMain.vb:line 72
       at ConnectionTools.HttpRequestResponse.OnDataArrival(DataArrivalEventArgs e) in D:\VS2008\WindowsApplication10\WindowsApplication10\clsHttpRequest.vb:line 51
       at ConnectionTools.HttpRequestResponse.ReadCallBack(IAsyncResult asyncResult) in D:\VS2008\WindowsApplication10\WindowsApplication10\clsHttpRequest.vb:line 199
       at System.Net.LazyAsyncResult..ctor(Object myObject, Object myState, AsyncCallback myCallBack, Object result)
       at System.Net.ConnectStream.BeginReadWithoutValidation(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
       at System.Net.ConnectStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
       at ConnectionTools.HttpRequestResponse.ReadCallBack(IAsyncResult asyncResult) in D:\VS2008\WindowsApplication10\WindowsApplication10\clsHttpRequest.vb:line 191
       at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
       at System.Net.ContextAwareResult.CompleteCallback(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Net.ContextAwareResult.Complete(IntPtr userToken)
       at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
       at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
       at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
  InnerException: 

AnswerRe: Mysterious Error [modified] Pin
Gregory Gadow2-Apr-09 9:51
Gregory Gadow2-Apr-09 9:51 
GeneralRe: Mysterious Error Pin
Dave_Lowe2-Apr-09 10:10
Dave_Lowe2-Apr-09 10:10 
GeneralRe: Mysterious Error Pin
Dave_Lowe2-Apr-09 10:20
Dave_Lowe2-Apr-09 10:20 
GeneralAh, I was looking at the wrong bit of your code Pin
Gregory Gadow2-Apr-09 10:43
Gregory Gadow2-Apr-09 10:43 
QuestionOutput Incorrect [SOLVED] Pin
vijay24822-Apr-09 4:03
vijay24822-Apr-09 4:03 
AnswerRe: Output Incorrect Pin
EliottA2-Apr-09 4:41
EliottA2-Apr-09 4:41 
GeneralMessage Closed Pin
2-Apr-09 5:23
vijay24822-Apr-09 5:23 
GeneralRe: Output Incorrect Pin
Jon_Boy2-Apr-09 6:03
Jon_Boy2-Apr-09 6:03 
Questionrun cmd.. Pin
p_19602-Apr-09 0:17
p_19602-Apr-09 0:17 
AnswerRe: run cmd.. Pin
Anubhava Dimri2-Apr-09 1:06
Anubhava Dimri2-Apr-09 1:06 
AnswerRe: run cmd.. Pin
Eddy Vluggen2-Apr-09 1:29
professionalEddy Vluggen2-Apr-09 1:29 
Question[Message Deleted] Pin
patricemburu1-Apr-09 21:46
patricemburu1-Apr-09 21:46 
AnswerRe: vb 6.0 Pin
Tom Deketelaere1-Apr-09 23:47
professionalTom Deketelaere1-Apr-09 23:47 
AnswerRe: vb 6.0 Pin
0x3c02-Apr-09 5:50
0x3c02-Apr-09 5:50 
AnswerRe: vb 6.0 Pin
Christian Graus3-Apr-09 0:00
protectorChristian Graus3-Apr-09 0:00 
QuestionHow to get the open file dialog size right ? Pin
fd97501-Apr-09 21:07
professionalfd97501-Apr-09 21:07 
AnswerRe: How to get the open file dialog size right ? Pin
Mycroft Holmes1-Apr-09 23:19
professionalMycroft Holmes1-Apr-09 23:19 

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.