Hey guys first time learning VB6 and i have to do a Hangman project for my Gr 10 class But i need some help. I am have trouble figuring out how i make the dashes come out in my label box when someone inputs a word.

Like say someone inputs the word Good. how would i make 4 dashes(__) come depending on the number of Letters that are in the word.

Here is my code, Thx in advance for your help.

Option Explicit

Dim strWordArray() As String
Dim intMasterArray() As Integer
Dim StrTitle As String
Dim LngIndex As Long
Dim intSize As Integer




Private Sub CmdDisplay_Click()
'( when you click this the dashes come up, idk how to do that but this is the button that is supposed to do it)


End If






End Sub

Private Sub Form_Load()
    StrTitle = InputBox("Input Letter", " Letter")
    intSize = Len(StrTitle)
    
ReDim strWordArray(1 To intSize)
ReDim intMasterArray(1 To intSize)

For LngIndex = 1 To intSize

 strWordArray(LngIndex) = Mid(StrTitle, LngIndex, 1)
 
 
 If strWordArray(LngIndex) = "_" Then
    intMasterArray(LngIndex) = strWordArray(LngIndex)
    
 ElseIf strWordArray(LngIndex) = "." Then
    intMasterArray(LngIndex) = strWordArray(LngIndex)
    
 ElseIf strWordArray(LngIndex) = "?" Then
     intMasterArray(LngIndex) = strWordArray(LngIndex)
     
 ElseIf strWordArray(LngIndex) = "!" Then
  intMasterArray(LngIndex) = strWordArray(LngIndex)
End If



    

Next LngIndex
    



End Sub

Recommended Answers

All 3 Replies

Hey guys first time learning VB6 and i have to do a Hangman project for my Gr 10 class

You have several errors in your English.

Hey, guys. This is the first time learning Visual Basic 6.0 (VB6). And I have to do a hangman project for my GR-10 class.

This is a more acceptable sentence structure.

You know, the mind is like a muscle: the more you exercise it, the stronger it becomes.

I'm not counting the spelling errors. They are too numerous to mention. If you hope to be of help to someone in the future, please first learn to help yourself by taking on the responsibilities incumbent upon a responsible descendant of Adam. If you will be faithful in the little things of life, people will call upon you for help in the bigger things.


But in answer to your problem ................

Your posted code is quite impressive. The style is excellent.

And I really think with a little effort you will come up with the answer.

hmm iv been trying g for the last 2 days and i haven't been able to come up with an answer. Can someone please give me some more help.

1. You need to determine the size of the word.

Dim strArray()

Private sub DetermineSize
  dim intSize as Integer
  intSize = len("Good")
  lblText = String(intSize, "-")

End sub

I really don't know, if that helps you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.