Re: tabControl help please?
- To: mathgroup at smc.vnet.net
- Subject: [mg48121] Re: tabControl help please?
- From: "Hans Michel" <hansjm at bellsouth.net>
- Date: Fri, 14 May 2004 00:12:20 -0400 (EDT)
- References: <email@example.com>
- Reply-to: "Hans Michel" <hansjm at bellsouth.net>
- Sender: owner-wri-mathgroup at wolfram.com
cdj: This is a C# problem. In any case are you creating a class/object that is based on the tabcontrol that contains: a tabpage, a picturebox, two button? Say you created an object based on tabControl. This mytabcontrol object when initialized (new) will contain or add a tabpage, a picturebox, two button. Button 1 creates a new tabpage; (AddEvent Handler for its function) Button 2 deletes current tabpage; (AddEvent Handler for its function) picturebox will get myImage Off to the side somewhere Two functions 1. Event Handler function for Button 1 2. Event Handler function for Button 2 You want access to the tabcontrol's current tabpage (in your object there is only one, index 0) . Add and place Button 1 and Button 2 in nice positions on tabpage and before you place picturebox on tabpage you insert whatever image it needs then place it on the tabpage; this save from having to go find tabcontrol's tabpage's picturebox. But if you want that picturebox after it is placed on the tabpage mytabcontrol.Item(0).Controls.Item(x) where Item(x) after iterating through tabpage controls collection is of type pictureBox. That is your object. There are many ways to do this. This comes to mind. But set it up correctly and you may never need direct access to the picturebox Hans "cdj" <a_cjones at hotmail.com> wrote in message news:c7uti0$qcf$1 at smc.vnet.net... > Hi all, > > I've got a tabControl, initially with one tabPage, along with two > buttons, one to add another tabPage, and one to delete the current > (selected) tabPage. > > On each tabPage, when it is created, is an pictureBox. > > Other stuff on the form leads to the creation of a graphic, say > myImage, which I would like to assign to the pictureBox.Image property > of the pictureBox on the currently selected tabPage. > > I've tried all sorts of things (and learned a lot about the tabControl > class - lol), but I can't for the life of me figure out how to refer > to: "the pictureBox on the currently-selected tabPage of the > tabControl". > > This is a let's-learn-C# project for myself, so any help would be much > appreciated. > > Thanks in advance, > > cdj >