TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
robertkjr
NA
61
0
Helpful info about Control Arrays in CE.NET
Dec 3 2004 3:41 PM
You can create a control array, of course it doesn't work in the IDE. You just have to declare it yourself. this.TreeViews = new TreeView[5]; this.TreeViews[0] = new TreeView(); this.TreeViews[0].ImageIndex = -1; this.TreeViews[0].Location = qPlace0.Location; this.TreeViews[0].SelectedImageIndex = -1; this.TreeViews[0].ShowLines = false; this.TreeViews[0].ShowPlusMinus = false; this.TreeViews[0].ShowRootLines = false; this.TreeViews[0].Size = qPlace0.Size; this.TreeViews[0].Visible = false; this.TreeViews[1] = new TreeView(); ... ... ... and so on qPlace0 is a label place holder that is in the IDE. Then you have to add them to the form individully as well: for (i = 0; i < 5; i++) { this.Controls.Add(this.TreeViews[i]); } Of course that is the 'get' we are stuck with as Microsoft decided to get rid of the IDE control arrays that we had with VB6. Today I just thought of perhaps an easier way. Say you put 5 TreeView Controls into the IDE. Then open up that code your not supposed to open in the region 'Windows Form Designer generated code'. And make sure each TreeView you put on the form are added in order. Like this: this.Controls.Add(this.TreeView1); this.Controls.Add(this.TreeView2); this.Controls.Add(this.TreeView3); this.Controls.Add(this.TreeView4); this.Controls.Add(this.TreeView5); Then to access these as an array like this: for (int i = Controls.GetChildIndex(TreeView1); i <= Controls.GetChildIndex(TreeView5); i++) { TreeView tv = (TreeView)Controls[i]; tv.Nodes.Add("Whatever!"); }
Reply
Answers (
0
)
Thread Limitation in Pocket PC 2002
Listviews in VB.NET for pocket pc 2002