VB6 Compile error methord or data member not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Luke Luke
    New Member
    • Nov 2011
    • 1

    #1

    VB6 Compile error methord or data member not found

    Hey when i go to run my code i get this compile error:
    Compile Error Methord or data member not found. i tried to debug this myself but i cant see why the error is occuring. I am making a simple hang-man game i will link the code below.
    Code:
    Option Explicit
    
    Private StrGuessLetter As String
    Private ArrWord As Variant
    Private ArrLetters As Variant
    Private IntTotalLetters As Integer
    Private strWord As String
    
    Private Sub Command1_Click()
    
        Dim i As Integer
        
        strWord = txtword.Text
        txtword.Text = "-"
        
        IntTotalLetters = Len(strWord)
        
        ReDim ArrWord(IntTotalLetters) As String
        ReDim ArrLetters(IntTotalLetters) As String
        
        For i = 1 To IntTotalLetters
            ArrWord(i) = Mid(strWord, i, 1)
            ArrLetters(i) = "-"
            txtword.Text = txtword.Text & ArrLetters(i) & " "
        Next
        
    End Sub
    
    Private Sub Command2_Click()
        Dim i As Integer, o As Integer
        Dim blnGuess As Boolean
        
            StrGuessLetter = txtguessletter.Text
            txtguessletter.Text = vbNullString
            
            For i = 1 To IntTotalLetters
                If ArrWord(i) = StrGuessLetter Then
                ArrLetters(i) = StrGuessLetter
                txtword.Text = vbNullString
                For o = 1 To IntTotalLetters
                    txtword.Text = txtword.Text & ArrLetters(o) & " "
                Next
                blnGuess = True
            Else
                If blnGuess Then
                Else
                    blnGuess = False
            End If
        End If
        Next
        If blnGuess = False Then
        lblGuesses.Caption = lblGuesses.Caption & " " & StrGuessLetter
            End If
                
            If InStr(1, txtword.Text, "-") = 0 Then
            Labell.Caption -"Winner"
            Else
                Label.Caption = "Enter your next letter"
        End If
    End Sub

    I am very new to any type of programming please could you reply in terms i can understand :P.
    Last edited by Stewart Ross; Nov 3 '11, 10:51 AM. Reason: Added code tags
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Please advise us on what line your error is occurring. I have added code tags to your code to make it easier to identify particular lines in your sub.

    -S

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #3
      I've moved this to the VB forum. Access / VBA is similar in some ways but not right for your question.

      Comment

      Working...