jcardana
Old to VB6, New to VB.NET
I'm attempting to create an array of textboxes. I need 55 of them (5 banks of 11).
After searching the internet , I came across two examples @ How to create Control Arrays in VB .NET
I was able to make it work successfully once but I couldn't figure out how to make the Events work, so I reverted.
Then I decided to try again and now I'm stuck.
jmcilhinney posted in another thread...
I've looked up Instancing, Declaring, Creating and didn't understand anything.
In the Error "details" I see...
Document
I saw something about a Dictionary on another website. Do I need to add a Dictionary entry?
Thanks for any and all help,
Joe
After searching the internet , I came across two examples @ How to create Control Arrays in VB .NET
I was able to make it work successfully once but I couldn't figure out how to make the Events work, so I reverted.
Then I decided to try again and now I'm stuck.
jmcilhinney posted in another thread...
In this case, it means txtPreset(i) is Nothing but I don't now how to make it not Nothing.It means that something on the lefthand side of a dot is Nothing.
I've looked up Instancing, Declaring, Creating and didn't understand anything.
In the Error "details" I see...
Document
Name | Value | Type | |
---|---|---|---|
head | Nothing | System.Collections.ListDictionaryInternal.DictionaryNode |
Thanks for any and all help,
Joe
VB.NET:
Public Class frmPresetRename
Public txtPreset(54) As TextBox
Public Sub New()
' This call is required by the designer.
InitializeComponent()
txtPreset(54) = New TextBox
End Sub
Private Sub frmPresetRename_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For i As Integer = 0 To 54
Dim txtPreset(i) As TextBox
With txtPreset(i)
.TextAlign = HorizontalAlignment.Center ' <-- System.NullReferenceException: 'Object reference not set to an instance of an object.'
.Font = New Drawing.Font("Consolas", 10, False, False)
.Top = 64 + (32 * (i Mod 11))
.Left = 48 + Int(i / 11) * 128
.Text = Chr((i \ 11) + Asc("A")) & i Mod 11 + 1
.Visible = True
End With
Controls.Add(txtPreset(i))
Next
End Sub
End Class