none
Please need desperate help for code for Guessing Array(very basic) RRS feed

  • Question

  • Hi, I am a beginner on Visual Studio.

    I am trying to make a very simple game; hangman. and I am having a really hard time trying to make a code for 'Guess Array' with For Loop. I have 26 alphabets buttons, and the words will be randomly chosen from a Dictionary textfile. It has "-" with For loop. As I click the buttons, it will search and replace the "-" to the word I selected if it is in the string;Substring.

    I understand all concept of Array, Substring, For loop, but I can't figure out how to put them together and make "Guess Array".

    I noticed that I am supposed to use 

    "Dim strGuessArray(30) As String" but I don't know why I am putting "30" in the parameter. I had to use "26" for the number of alphabets, but I don't get why I use "30" for GuessArray.

    Could you give me an idea how to do Guess Array?

    Thank you.



    Monday, March 5, 2018 4:44 PM

All replies

  • Who says "use 30"? What happens, if you use "25"?

    Ashidacchi >> http://hokusosha.com/

    Monday, March 5, 2018 5:58 PM
  • Hi friend,

    Welcome to the MSDN forum.

    It seems your issue is about the VB development, since our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum for a better support, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, March 6, 2018 2:17 AM
  • Hi, I am a beginner on Visual Studio.

    I am trying to make a very simple game; hangman. and I am having a really hard time trying to make a code for 'Guess Array' with For Loop. I have 26 alphabets buttons, and the words will be randomly chosen from a Dictionary textfile. It has "-" with For loop. As I click the buttons, it will search and replace the "-" to the word I selected if it is in the string;Substring.

    I understand all concept of Array, Substring, For loop, but I can't figure out how to put them together and make "Guess Array".

    I noticed that I am supposed to use 

    "Dim strGuessArray(30) As String" but I don't know why I am putting "30" in the parameter. I had to use "26" for the number of alphabets, but I don't get why I use "30" for GuessArray.

    Could you give me an idea how to do Guess Array?

    Thank you.



    Hi rkdkks4722,

    You said that you understand all concept of array, substring, for loop, but you don't know how to put them together and make "Guess Array", I am not sure what you want to do, can you describe more detailed info about this, or you can give one example here?

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 6, 2018 2:19 AM
    Moderator
  • In regards to simple, that is dependent not only on your understanding of things but also having used them in code.

    You could peek at a well done code sample done in VS2012.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, March 6, 2018 2:25 AM
    Moderator
  • Actuall "Dim strGuessArray(30) As String" creates 31 indices and not 30. So you would have space for 31 items. Which is why Ashidacchi mentions using 25 and not 26.

    La vida loca

    Tuesday, March 6, 2018 1:03 PM
  • @Mr. Monkeyboy,
      Thank you for your following up my post.

    @rkdkks4722,
      As Mr. Monkeyboy mentions, lower limit of an array is 0 (zero). i.e. element of an array is described like myArray(0) = "first", myArray(1) = "second".
      If you define an array without element count like Dim myArray() as String, you need to use ReDim statement like ReDim myArray(25).... this make myArray have 26 elements in it.

      I hope the issue is resolved. 

    Regards,




      

    Ashidacchi >> http://hokusosha.com/

    Tuesday, March 6, 2018 11:20 PM
  • @Sara I do not believe this discussion is limited the IDE.

    Discuss and ask questions about the Visual Basic programming language, IDE, libraries, samples, and tools. (Not for VB6 questions).

    That is what the description says.


    Mary

    Wednesday, March 7, 2018 11:45 AM
  • Another homework assignment all wrapped up.

    Mary

    Wednesday, March 7, 2018 11:46 AM