CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2000
    Location
    CA, USA
    Posts
    88

    calling a method within a form is causing the app to hang

    Hello all,

    On our application that is on a stand-a-lone industrial type PC with a touch screen I am seeing our application freeze. From using Event Logging and NuMega's FailSafe's Visual Tracer it appears that application is hanging/locking up from the transistion from Me.Show vbModal to the Form_Activate method. I am sorry for the code flood, but I list all the relavant code in hoping someone can see what might be causing it to hanging. I had logging event at the begging of each method and one before and after it call another method. From the logging it looks like the last command excuted was

    mbSingleSelectionMode = true from



    which is in the frmSelection::mGetSelection method right before calling Me.Show vbModal Any help very muched welcomed and GREATLY appreciated. Thanks

    Mark

    frmViewChannel

    cmdSelection_Click
    select case SelectionType
    case Case1, Case2
    frmSelection.mGetSelection param1, param2, param 3
    case Case2 ....
    End Select




    frmSelection

    public Function msGetSelection(SelectionType as Long, Heading as string, SelectionBoxHeading as string, Filter as string, _
    rsCancelButtonText as string, rnCancelButtonHotKey as Integer) as string

    LocalHeading = Heading
    LocalSelectionType = SelectionType
    LocalSelectionBoxHeading = SelectionBoxHeading
    LocalFilter = Filter & vbNullChar
    btnCancel.Text = rsCancelButtonText
    mnCancelButtonHotKey = rnCancelButtonHotKey
    btnSelect.Visible = false
    btnRemove.Visible = false
    btnSelect.Enabled = false
    btnRemove.Enabled = false
    mbSingleSelectionMode = true
    me.Show vbModal
    msGetSelection = LocalSelection
    End Function

    private Sub Form_Activate()
    Heading.Caption = LocalHeading
    SelectionBoxHeading.Caption = LocalSelectionBoxHeading
    If Not mbSingleSelectionMode then btnOK.Enabled = false
    mbLocalFillDone = false
    Timer1.Enabled = true

    While Not mbLocalFillDone
    DoEvents
    Wend

    If (SelectionBox.ListCount > 0) And (LocalSelectionType <> gnAIRSHOW_LANGUAGE_SELECTION) then
    btnRemove.Enabled = true
    else
    btnRemove.Enabled = false
    End If

    If (LocalSelectionType = gnAIRSHOW_ACARS_MESSAGE_SELECTION) then
    If (SelectionBox.ListCount > 0) And (mACARSMsgsEnabledList(0)) then
    btnSelect.Enabled = false
    btnRemove.Enabled = true
    else
    If SelectionBox.ListCount > 0 then
    btnSelect.Enabled = true
    btnRemove.Enabled = false
    else
    btnSelect.Enabled = false
    btnRemove.Enabled = false
    End If
    End If
    End If
    End Sub

    private Sub Form_Load()
    KeyPreview = true
    Top = (frmStartup.Height - Height) / 2
    Left = (frmStartup.Width - Width) / 2
    End Sub

    private Sub Timer1_Timer()
    Timer1.Enabled = false
    SelectionBox.Clear
    Select Case LocalSelectionType
    Case gnCURRENCY_SELECTION
    FillBoxWithCurrencies
    Case gnSINGLE_MOVIE_SELECTION
    FillBoxWithMovieTitles
    Case gnAIRSHOW_DISPLAY_MODE_SELECTION
    FillBoxWithAirshowDisplayModes
    Case gnAIRSHOW_ACARS_MESSAGE_SELECTION
    FillBoxWithAirshowACARS_Messages
    Case gnAIRSHOW_LANGUAGE_SELECTION
    FillBoxWithAirshowLanguages
    Case gnAIRSHOW_WEATHER_SELECTION ' GN
    FillBoxWithAirshowWeatherList
    Case gnDIGITAL_VIDEO_SELECTION, gnDIGITAL_AUDIO_SELECTION
    FillBoxWithDigitalMediaTitles 'LVOD EMH
    Case gnBDV_SELECTION, gnBDA_SELECTION
    FillBoxWithBroadcastDigitalMediaTitles 'LVOD TW
    Case gnDIGITAL_VIDEO_STREAM_SELECTION
    FillBoxWithStreamingDigitalMediaTitles
    End Select
    If (SelectionBox.ListCount > 0) then SelectionBox.Selected(0) = true
    mbLocalFillDone = true
    Screen.MousePointer = vbDefault
    End Sub

    private Sub FillBoxWithBroadcastDigitalMediaTitles()
    Dim sTitle as string
    Dim j as Integer, i as Integer, K as Integer
    Dim bTemp as Boolean, bFound as Boolean

    Screen.MousePointer = vbHourglass
    on error resume next

    bFound = false ' otherwise we populate the list box with prev contents of strMedia

    for i = 1 to UBound(gArrayMFS)
    If (LocalSelectionType = gnBDV_SELECTION And gArrayMFS(i).MediaType = 1 And gArrayMFS(i).BDAVServiceMap <> 0) then
    sTitle = gsCAPIStringToString(gArrayMFS(i).Title)
    ReDim Preserve strMedia(j)
    bFound = true
    bTemp = false
    If UBound(strMedia) > 0 then
    for K = 0 to (UBound(strMedia) - 1)
    If gArrayMFS(i).Title = strMedia(K).Title then
    bTemp = true
    Exit for
    End If
    next K
    End If

    If bTemp = false then
    strMedia(j).MediaID = gArrayMFS(i).MediaID
    strMedia(j).Title = sTitle
    j = j + 1
    End If
    else
    If (LocalSelectionType = gnBDA_SELECTION And gArrayMFS(i).MediaType = 2 And gArrayMFS(i).BDAVServiceMap <> 0) then
    sTitle = gsCAPIStringToString(gArrayMFS(i).Title)
    ReDim Preserve strMedia(j)
    bFound = true
    bTemp = false
    If UBound(strMedia) > 0 then
    for K = 0 to (UBound(strMedia) - 1)
    If gArrayMFS(i).Title = strMedia(K).Title then
    bTemp = true
    Exit for
    End If
    next K
    End If

    If bTemp = false then
    strMedia(j).MediaID = gArrayMFS(i).MediaID
    strMedia(j).Title = sTitle
    j = j + 1
    End If
    End If
    End If
    next i

    SelectionBox.Clear
    If bFound then
    for i = 0 to UBound(strMedia)
    SelectionBox.AddItem strMedia(i).Title
    ' strMedia(j).MediaID
    next i
    End If
    on error GoTo 0
    Screen.MousePointer = vbDefault
    End Sub




  2. #2
    Join Date
    Jun 2000
    Location
    Nepal
    Posts
    108

    Re: calling a method within a form is causing the app to hang

    Your problem seems to be with

    Me.Show vbModal

    What exactly do you put that in there for?

    Try excluding the vbModal


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured