RE:AYUDA crear una matriz
'Este sencillo ejemplo lo hecho en VB2005
'Para este ejemplo debes tener como minimo un boton creado
Imports System.IO
Public Class Form1
Dim dic As New Dictionary(Of Object, String())
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each btn As Control In Me.Controls
If btn.GetType Is GetType(System.Windows.Forms.Button) Then
dic.Add(btn.Name, GetObjInfo(btn))
End If
Next
Dim strWrite As New StreamWriter("C:\Sample.txt", True)
For Each kpv As KeyValuePair(Of Object, String()) In dic
Dim info As String = Nothing
'Aqui lo guardamos en un archivo una propiedad por linea
strWrite.WriteLine(kpv.Key.ToString)
strWrite.WriteLine("----------------------------")
For x As Int32 = 0 To kpv.Value.GetUpperBound(0)
strWrite.WriteLine(kpv.Value.GetValue(x).ToString)
'Esta linea existe solo para mostrala en el messagebox
'Para ver la informacion
info = info & Space(4) & kpv.Value.GetValue(x).ToString
Next
strWrite.WriteLine("")
strWrite.WriteLine("")
MsgBox(info)
Next
strWrite.Close()
End Sub
Function GetObjInfo(ByVal Objeto As Button) As String()
If Objeto.Image Is Nothing Then
Dim str() As String = {"Texto: " & Objeto.Text, "Color: " & Objeto.BackColor.Name, "Imagen: " & "no tiene imagen", "Ubicacion: " & Objeto.Location.ToString}
Return str
Else
Dim str() As String = {"Texto: " & Objeto.Text, "Color: " & Objeto.BackColor.Name, "Imagen: " & "tiene imagen", "Ubicacion: " & Objeto.Location.ToString}
Return str
End If
End Function
End Class