CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2012
    Location
    .NET framework V 4.0
    Posts
    2

    New to VB making hangman game

    Hi, for starters i am very new to VB and i am trying to self teach myself(not going to well). i have started a hang man program but i am lost on how to refrence lbls that i have made into a list of lables. the code listed below is a function that adds lables to a form based on a word size. If anyone can help me reference these labels so i can check them and then make them visible it would be very much appriciated. thanks in advance

    Dim ret As New List(Of Label)
    Dim curtop As Integer = 103
    Dim curleft As Integer = 122

    For Each C As Char In word
    Dim lbl As New Label
    lbl.Visible = False
    lbl.Text = C
    lbl.Top = curtop
    lbl.Left = curleft

    curleft += 40



    ret.Add(lbl)
    Next
    Return ret.ToArray

    End Function

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: New to VB making hangman game

    You reference the items collection to access an item in the list
    i.e
    Code:
    ret.items(index)
    You will have to add the labels to the form.controls collection before they will show on the form
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jun 2012
    Location
    .NET framework V 4.0
    Posts
    2

    Re: New to VB making hangman game

    add them as in putting

    ME.Controls.AddRange(functionname(word))

    that's how i call the function

  4. #4
    Join Date
    Jun 2012
    Posts
    3

    Re: New to VB making hangman game

    here is the hangman game I developed for grades 6-9 for summer computer camp.
    http://employee.heartland.edu/tmulli...cNet/index.pdf
    the pdf doesn't allow right clicking to get images so change the index.pdf to index.htm. the htm version is not formatted so I don't use it in class. Hope it helps.
    T

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

Featured