DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Compile error

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Compile error

    [Originally posted by Dave]

    Hi, this is a strange one

    I have this code in a class module:

    Private miSetLabel(1 To giMaxWizPages, 0 To 9, 0 To 1) As Integer˙ 

    And I have this in a standard module where I declare any globals:

    Public Const giMaxWizPages As Integer = 12

    These are the ONLY (currently) references to the constant giMaxWizPages in the whole program. But when I try to run I get a compile error stating that there are circular dependencies between modules, which is rot as far as I can see. If I put a literal in, it's fine of course.

    I'm running VB6 SP5.
    HELP please. By the way it used to work fine until I turned one of my other classes into an array. (That class does not reference the constant at all).

    I've re-installed SP5 to no avail. Wierd huh?

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Compile error

    [Originally posted by FreeVBCode.com]

    Weird yes.˙ Can you post the code for the other class, or enough of the other class to create the error?

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Compile error

    [Originally posted by Dave]

    Hi here's the code. What seems to have made the difference is that I'm now creating the clsWizPage as a single object of an array, whereas before it was a single, once-only instantiated object. I've had to modify several of the array variables to include another dimension (recognisable as gePref in the x dimension). It all works fine except the previously mentioned problem.

    Thanks for your help

    Dave.....


    'Author: Dave Green
    'This class constructs the Preference Wizard dynamically - called from the Wizard object - single instantiation only
    Option Explicit
    Private miCurrentPage As Integer˙ ˙ 'The current page number of the Pref wizard
    Public Sub Create()
    'This method sets the parameters for all the controls in the Pref Wizard

    ˙ ˙ 'Set the page sequencing for the Pref wizard (y0=Back; y1=Next; yValue(0=disable; =>1=page to goto))
    ˙ ˙ giWizPageSequence(gePref, 1, 0) = 0
    ˙ ˙ giWizPageSequence(gePref, 1, 1) = 2
    ˙ ˙ giWizPageSequence(gePref, 2, 0) = 1
    ˙ ˙ giWizPageSequence(gePref, 2, 1) = 0
    ˙ ˙ giWizPageSequence(gePref, 3, 0) = 2
    ˙ ˙ giWizPageSequence(gePref, 3, 1) = 5

    ˙ ˙ Set goWizPage(gePref) = New clsWizPage

    ˙ ˙ 'Inform WizPage object of the calling wizard
    ˙ ˙ goWizPage(gePref).WizType = "Pref"

    ˙ ˙ 'Prepare the form
    ˙ ˙ goWizPage(gePref).Generics
    ˙ ˙ goWizPage(gePref).Caption = "Preference Wizard"

    ˙ ˙ 'Set up all the controls for the whole Wizard
    ˙ ˙ 'Page 1 (Start)
    ˙ ˙ goWizPage(gePref).SetLabel(1, 0, 3690, 150, True) = "PREFERENCE WIZARD"
    ˙ ˙ goWizPage(gePref).SetImageBox(1, 0, 1000, 400, 8000, 5000) = App.Path & "\Images\pref.gif"
    ˙ ˙ 'Page 2 (Add Edit or Delete)
    ˙ ˙ goWizPage(gePref).SetLabel(2, 0, 1800, 150, True) = "Add a New Preference, Edit or Delete an Existing Preference"
    ˙ ˙ goWizPage(gePref).SetListBox(2, 0, 1000, 400, 6600, 3000, "Preference") = "Name"
    ˙ ˙ goWizPage(gePref).SetButton(2, 0, 1100, 4000, 855, 255, True) = "Add"
    ˙ ˙ goWizPage(gePref).SetButton(2, 1, 3860, 4000, 855, 255, False) = "Edit"
    ˙ ˙ goWizPage(gePref).SetButton(2, 2, 6620, 4000, 855, 255, False) = "Delete"
    ˙ ˙ goWizPage(gePref).SetLine(2, 0, 1100, 4500, 7475) = 4500
    ˙ ˙ 'Page 3 (Add)
    ˙ ˙ goWizPage(gePref).SetLabel(3, 0, 3600, 150, True) = "Add a New Preference"
    ˙ ˙ goWizPage(gePref).SetLabel(3, 1, 300, 450, False) = "Name of Preference"
    ˙ ˙ goWizPage(gePref).SetTextBox(3, 0, 300, 660, 2100, 255) = ""

    ˙ ˙ 'Display the first page of the Pref Wizard
    ˙ ˙ miCurrentPage = 1
    ˙ ˙ goWizPage(gePref).Page = miCurrentPage
    End Sub
    Public Sub EventHandler(Control As String, Action As String, Data As Variant, ListIndex As Integer, Index As Integer)
    'This method handles all events passed back from the originating form, via the WizPage object
    ˙ ˙ If miCurrentPage = 2 And Control = "ListBox" And Action = "Click" And Index = 0 Then
    ˙ ˙ ˙ ˙ goWizPage(gePref).SetButton(2, 1, 3860, 4000, 855, 255, True) = "Edit"
    ˙ ˙ ˙ ˙ goWizPage(gePref).SetButton(2, 2, 6620, 4000, 855, 255, True) = "Delete"
    ˙ ˙ ˙ ˙ goWizPage(gePref).Page = 2
    ˙ ˙ ˙ ˙ goWizPage(gePref).SetButton(2, 1, 3860, 4000, 855, 255, False) = "Edit"
    ˙ ˙ ˙ ˙ goWizPage(gePref).SetButton(2, 2, 6620, 4000, 855, 255, False) = "Delete"
    ˙ ˙ End If
    ˙ ˙ If miCurrentPage = 2 And Control = "Button" And Action = "Click" And Index = 0 Then
    ˙ ˙ ˙ ˙ goWizPage(gePref).Page = 3
    ˙ ˙ ˙ ˙ miCurrentPage = 3
    ˙ ˙ End If
    End Sub
    Public Sub BackPage()
    'This method handles the "Back event" when passed back from the form via the wizpage object

    ˙ ˙ 'Should the Next button on the page we're going back to be disabled
    ˙ ˙ If giWizPageSequence(gePref, giWizPageSequence(gePref, miCurrentPage, 0), 1) = 0 Then
    ˙ ˙ ˙ ˙ goWizPage(gePref).NextEnabled = False
    ˙ ˙ Else
    ˙ ˙ ˙ ˙ goWizPage(gePref).NextEnabled = True
    ˙ ˙ End If

    ˙ ˙ 'Should the Back button on the page we're going back to be disabled
    ˙ ˙ If giWizPageSequence(gePref, giWizPageSequence(gePref, miCurrentPage, 0), 0) = 0 Then
    ˙ ˙ ˙ ˙ goWizPage(gePref).BackEnabled = False
    ˙ ˙ Else
    ˙ ˙ ˙ ˙ goWizPage(gePref).BackEnabled = True
    ˙ ˙ End If

    ˙ ˙ 'Retard the page to the previous in the sequence
    ˙ ˙ miCurrentPage = giWizPageSequence(gePref, miCurrentPage, 0)
    ˙ ˙ goWizPage(gePref).Page = miCurrentPage
    End Sub
    Public Sub NextPage()
    'This method handles the "Next event" when passed back from the form via the wizpage object

    ˙ ˙ 'Should the Next button on the page we're going next to be disabled
    ˙ ˙ If giWizPageSequence(gePref, giWizPageSequence(gePref, miCurrentPage, 1), 1) = 0 Then
    ˙ ˙ ˙ ˙ goWizPage(gePref).NextEnabled = False
    ˙ ˙ Else
    ˙ ˙ ˙ ˙ goWizPage(gePref).NextEnabled = True
    ˙ ˙ End If

    ˙ ˙ 'Should the Back button on the page we're going next to be disabled
    ˙ ˙ If giWizPageSequence(gePref, giWizPageSequence(gePref, miCurrentPage, 1), 0) = 0 Then
    ˙ ˙ ˙ ˙ goWizPage(gePref).BackEnabled = False
    ˙ ˙ Else
    ˙ ˙ ˙ ˙ goWizPage(gePref).BackEnabled = True
    ˙ ˙ End If

    ˙ ˙ 'Advance the page to the next in the sequence
    ˙ ˙ miCurrentPage = giWizPageSequence(gePref, miCurrentPage, 1)
    ˙ ˙ goWizPage(gePref).Page = miCurrentPage
    End Sub


  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Compile error

    [Originally posted by FreeVBCode.com]

    I don't really understand circular dependencies all that well, but If I had to guess it looks like the problem is due to having a number of variables defined as miSetLabels in the third module.˙ First thing I would try is making giMaxWizPages a variable rather than a constant and setting it's value in a main subroutine of the module.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:Compile error

    [Originally posted by Dave]

    Hi, yes I've thought about that (and haven't got round to it yet). I'll certainly give it a try. But it's annoying - even if I comment virtually everything out I still get the error!!!
    It's got to be a bug in VB - or its me being completely daft - (odds are its the latter)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center