Re: Strange problem

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Larry Serflaten (serflaten_at_usinternet.com)
Date: 07/28/04


Date: Wed, 28 Jul 2004 04:23:27 -0500


"stoitchko" <stoitchko@discussions.microsoft.com> wrote
> yes, here is the problem
> even more when i mark this part of the code as comment no error msgs at all
> at vcpp i would use another thread for this but here ...??

The only thing I saw that might be questionable was your use of a VB Keyword:

m_prb.Val = fileIndex ' Val is a Keyword
m_prb.lbMsg = "fkjhdfjfdhj"
m_prb.SetFocus
m_prb.Refresh

Those things are being done together, so what you might try is to combine
them into a single call, passing in the parameters you need for display:

' In m_prb form

Public Sub Update(ByVal Value as Long, ByRef Msg As String)
  If Me.Visible then
    lblMsg.Caption = Msg
    lblMsg.Refresh
    prgBar.Value = Value
    prgBar.Refresh
  End If
End Sub

You could then make a single call to do the update:

  m_prb.Update FileIndex, "Whatever..."

Then to insure you are not trying to call on a form that isn't there you
could add a test to be sure it exists:

  If Not m_prb Is Nothing Then
    m_prb.Update FileIndex, "Whatever..."
  End If

Basically you have to defend yourself against anything that could go wrong.

LFS



Relevant Pages

  • Re: Concatenating control names
    ... Public Sub DooDad(Frm As Form, LabelNum As Integer, Msg As String) ... Dim oLabel As Label ... You'll see that I have called the error routine (DooDad ...
    (microsoft.public.vb.general.discussion)
  • Re: Concatenating control names
    ... Public Sub DooDad(Frm As Form, LabelNum As Integer, Msg As String) ... Dim oLabel As Label ...
    (microsoft.public.vb.general.discussion)
  • Re: Outlook.Items collection & VB6
    ... Public Sub Main ... Dim msg As MailItem ...
    (microsoft.public.vb.general.discussion)
  • Re: Manipulating controls created by another thread
    ... Delegate Sub DisplayStatus(ByVal msg As String) ... Dim t As New Threading.Thread ... Public Sub Status ... Public Class Worker ...
    (microsoft.public.dotnet.languages.vb)