|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Various issues with arrays
First of all, I need to read an array of strings into a label at a time, and display the label. For some reason, the labels don't display.
Code:
Sub CreateGoldLabels()
Dim ArrayOfBucks(Box_no) As String
ArrayOfBucks(0) = "£0.01"
ArrayOfBucks(1) = "£0.10"
ArrayOfBucks(2) = "£0.50"
ArrayOfBucks(3) = "£1"
ArrayOfBucks(4) = "£5"
ArrayOfBucks(5) = "£10"
ArrayOfBucks(6) = "£50"
ArrayOfBucks(7) = "£100"
ArrayOfBucks(8) = "£250"
ArrayOfBucks(9) = "£500"
ArrayOfBucks(10) = "£750"
ArrayOfBucks(11) = "£1,000"
ArrayOfBucks(12) = "£3,000"
ArrayOfBucks(13) = "£5,000"
ArrayOfBucks(14) = "£10,000"
ArrayOfBucks(15) = "£15,000"
ArrayOfBucks(16) = "£20,000"
ArrayOfBucks(17) = "£35,000"
ArrayOfBucks(18) = "£50,000"
ArrayOfBucks(19) = "£75,000"
ArrayOfBucks(20) = "£100,000"
ArrayOfBucks(21) = "£250,000"
Dim X, Y, k, counter As Integer '4 variables
X = 56 'coordinates XY
Y = 24
counter = 0
For k = 0 To (Box_no - 1) ' box_no = 22
counter += 1
Glabel(counter) = New Label
Glabel(counter).Size = New Size(56, 24)
Glabel(counter).Location = New Point(X, Y)
Glabel(counter).BackColor = Color.Silver
Glabel(counter).Text = ArrayOfBucks(k)
Glabel(counter).Visible = True
Glabel(counter).Enabled = True
Y += 32
If counter = (Box_no / 2) Then
X = 472
End If
Next
End Sub
Also, I want to read the array into a label randomly. So after I've read them into the labels consecutively 1-22, I want to read them into a seperate set of labels at random. I know the codes a bit dodgy, and you can write arrays quicker than that, but I really don't care, it's some lame project I have to do. |
|
#2
|
||||
|
||||
|
For the label to be displayed, you have to add the control to a container (eg. a Form). For example you have to do something like this
Form1.Controls.Add(Glabel(x)) Try this, you ll get your label displayed
__________________
Ahmed Shefeer Manchester United English Premier League 2007, 2008 Champions |
|
#3
|
|||
|
|||
|
Any idea how to randomly get numbers from the array into some label.text's??
A man u supporter too. ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > Various issues with arrays |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|