control-array

Creating control from 'control array?'

风流意气都作罢 提交于 2019-12-11 03:51:26
问题 I have an array of picture boxes as so: Dim pieces(500) As PictureBox pieces(1) = New PictureBox With pieces(1) .CreateControl() .Visible = True .BackColor = Color.Red .Width = 50 .Height = 50 .Left = 50 .Top = 50 End With The program does not crash or anything, but the picturebox is no where to be seen on the form. How to I make this work correctly? And is 'Control Array' the correct term for this? or something else? 回答1: It won't show up until you add those PictureBoxes to a form. I suppose

What's the simplest .NET equivalent of a VB6 control array?

泄露秘密 提交于 2019-11-28 13:30:36
Maybe I just don't know .NET well enough yet, but I have yet to see a satisfactory way to implement this simple VB6 code easily in .NET (assume this code is on a form with N CommandButtons in array Command1() and N TextBoxes in array Text1()): Private Sub Command1_Click(Index As Integer) Text1(Index).Text = Timer End Sub I know it's not very useful code, but it demonstrates the ease with which control arrays can be used in VB6. What is the simplest equivalent in C# or VB.NET? Make a generic list of textboxes: var textBoxes = new List<TextBox>(); // Create 10 textboxes in the collection for

What's the simplest .NET equivalent of a VB6 control array?

╄→гoц情女王★ 提交于 2019-11-27 06:47:39
问题 Maybe I just don't know .NET well enough yet, but I have yet to see a satisfactory way to implement this simple VB6 code easily in .NET (assume this code is on a form with N CommandButtons in array Command1() and N TextBoxes in array Text1()): Private Sub Command1_Click(Index As Integer) Text1(Index).Text = Timer End Sub I know it's not very useful code, but it demonstrates the ease with which control arrays can be used in VB6. What is the simplest equivalent in C# or VB.NET? 回答1: Make a