Results 1 to 3 of 3

Thread: can you disable MsgBox messages from being shown?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75

    Question

    OK heres the situation:

    I am loading a file which is just a .MDB file with information needed to be placed on a form.
    The form contains controls such as checkboxes and text boxes into which the information isloaded from the .MDB file.

    It loads fine except for one problem.

    On some of the controls have have MsgBox reminders that popup when a user does something...for example:

    When the user clicks on checkbox1 the following message is displayed..

    "Make sure you add x because you checked this box"

    I want this message to appear when the user is using the program but not to appear when the user is loading the saved file which is the .MDB file.

    My question is: Is there a way to disable the message boxes? To stop them from even appearing?...and API call or something that locks the screen prehaps.

    I can just use a global boolean flag and set it to true while loading and then put a check on all the messages but this is messy....anyone know of another way?

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    There are several things that you can do (that I can think of), but none are as easy as the global boolean.

    1. Add code to each checkbox and all other affected controls that says
    Code:
    Private Sub Check1_Click()
    
        If Check1.Visible Then ' Screen.ActiveControl will return a
                               ' trappable error if the control is not visible
            If Screen.ActiveControl.Name = "Check1" Then
                MsgBox "Make sure you add x because you checked this box"
            End If
        End If
    
    End Sub
    2. Create Properties in your form for each control with code like the following
    Code:
    Option Explicit
    Private mint_Check1Value As Integer
    
    Public Property Get Check1Value() As Integer
    
        Check1.Value = mint_Check1Value
        
    End Property
    
    Public Property Let Check1Value(ByVal intValue As Integer)
    
        'mint_Check1Value = your value from the database
        
    End Property
    And then do "Check1.Value = Check1Value" whenever it's convenient. (That code will exercise the Property Get and return the database value that was created when you loaded the data from the database into the Property Let.)
    3. If you already have a Class in your project, add an IsLoading Let/Get Boolean property or create a new class that has that Property and use it just like you would use your global boolean. While this functions just like a Global variable it's more acceptable.


  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75
    Excellent...thank you for the ideas.

    Once again I bow to your superior knowledge



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