Hi,
I'm trying to create a programme which generates a matrix with variable sized rows and columns. Now to reduce the amount of useless code i want to have it so that the labels are automatically generated.
I've tried creating an array of labels.
The following code seems to work when i debug it but the labels do not show up on the form after running. It does not stall or crash it just executes the program and that's it. What code do i need to make the labels appear on the form?
Or may it be that they just fall of the screen? Maybe i chose the coordinates wrong?.
Thanks i.a.
I'm trying to create a programme which generates a matrix with variable sized rows and columns. Now to reduce the amount of useless code i want to have it so that the labels are automatically generated.
I've tried creating an array of labels.
The following code seems to work when i debug it but the labels do not show up on the form after running. It does not stall or crash it just executes the program and that's it. What code do i need to make the labels appear on the form?
Or may it be that they just fall of the screen? Maybe i chose the coordinates wrong?.
Code:
Imports System.Math
Public Class frmMatrix
Dim lblKolom() As System.Windows.Forms.Label
Private Sub btnBereken_Click(....
Dim intPicX, intPicY, intPixelWaarde, intTellerX, intTellerY As Integer
Dim intMatrix(,) As Integer
Dim strKolom As String = ""
Dim strPixel As String
intPicX = Rnd() * 5 + 4
intPicY = Rnd() * 5 + 4
ReDim intMatrix(intPicX - 1, intPicY - 1)
ReDim lblKolom(intPicX - 1)
For intTellerX = 0 To intPicX - 1
Me.lblKolom(intTellerX) = New System.Windows.Forms.Label
Me.lblKolom(intTellerX).Location = New System.Drawing.Point(12, 49 + (intPicX * 24))
Me.lblKolom(intTellerX).Name = "Kolom" + Str(intTellerX)
Me.lblKolom(intTellerX).TabIndex = intTellerX + 2
Me.lblKolom(intTellerX).AutoSize = True
Me.lblKolom(intTellerX).Visible = True
Me.lblKolom(intTellerX).TextAlign = ContentAlignment.MiddleCenter
Me.lblKolom(intTellerX).BackColor = Color.CadetBlue
Me.lblKolom(intTellerX).Show()
Next intTellerX
For intTellerX = 0 To intPicX - 1
For intTellerY = 0 To intPicY - 1
...
Next intTellerY
lblKolom(intTellerX).Text = strKolom
...
Next intTellerX
End Sub
Private Sub Form1_Load(...
Randomize()
End Sub
End Class
Comment