-
June 19th, 2012, 06:04 PM
#1
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
-
June 19th, 2012, 10:42 PM
#2
Re: New to VB making hangman game
You reference the items collection to access an item in the list
i.e
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.
-
June 19th, 2012, 11:24 PM
#3
Re: New to VB making hangman game
add them as in putting
ME.Controls.AddRange(functionname(word))
that's how i call the function
-
June 20th, 2012, 12:50 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|