473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

help with tabControl confusion please?

cdj
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
Nov 16 '05 #1
3 2239
Are you talking about this?
================================================== ====
private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)

{

tabControl1.SelectedTab.Controls.Add(pictureBox1);

}

================================================== ================

Now in this code if you want to change the image of picture box just change
it before using it.

"cdj" <a_******@hotmail.com> wrote in message
news:b0**************************@posting.google.c om...
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

Nov 16 '05 #2
cdj
"ISMAILRAJPUT" <hu************@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Are you talking about this?
================================================== ====
private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)

{

tabControl1.SelectedTab.Controls.Add(pictureBox1);

}

================================================== ================
Not quite - I've already put pictureBoxes on the newly-made
tabPages......... What I need to do now is put a graphic, say myImage, into
the myPicBox.Image property of the pictureBox of the currently selected
tabPage. In other words, I just need a statement of the following form:

(pictureBox control on the currently selected tabPage on the
tabControl).Image = myImage;

Of course, the stuff in parentheses isn't valid c#, which is why I'm
here.... I just don't know how to refer to a control I've created
programmatically.... :(

I've been looking thru the tabControl class library, but I just don't see
what I use from there to make a statement such as the above.

Somewhat more generally, I was hoping to make a variable, to wit
currentPictureBox, which would be updated with the pictureBox on the current
tabPage according to the SelectedIndexChanged event.

thanks for your response though,

cdj
Now in this code if you want to change the image of picture box just change it before using it.

"cdj" <a_******@hotmail.com> wrote in message
news:b0**************************@posting.google.c om...
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


Nov 16 '05 #3
here is another way
================================================== =======

private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)

{

pictureBox1.Image = System.Drawing.Image.FromFile("C:\\goldepic2.jpg") ;

tabControl1.SelectedTab.Controls.Add(pictureBox1);

}

================================================== ===================

"cdj" <sh*************@hotmail.com> wrote in message
news:uf*************@TK2MSFTNGP11.phx.gbl...
"ISMAILRAJPUT" <hu************@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Are you talking about this?
================================================== ====
private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)

{

tabControl1.SelectedTab.Controls.Add(pictureBox1);

}

================================================== ================
Not quite - I've already put pictureBoxes on the newly-made
tabPages......... What I need to do now is put a graphic, say myImage,

into the myPicBox.Image property of the pictureBox of the currently selected
tabPage. In other words, I just need a statement of the following form:

(pictureBox control on the currently selected tabPage on the
tabControl).Image = myImage;

Of course, the stuff in parentheses isn't valid c#, which is why I'm
here.... I just don't know how to refer to a control I've created
programmatically.... :(

I've been looking thru the tabControl class library, but I just don't see
what I use from there to make a statement such as the above.

Somewhat more generally, I was hoping to make a variable, to wit
currentPictureBox, which would be updated with the pictureBox on the current tabPage according to the SelectedIndexChanged event.

thanks for your response though,

cdj
Now in this code if you want to change the image of picture box just

change
it before using it.

"cdj" <a_******@hotmail.com> wrote in message
news:b0**************************@posting.google.c om...
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



Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould...
1
by: NewGuy | last post by:
Is there a way to change the Text format for just the Tab Title? I have a form with 3 tabs on it If conditions are met I would like to modify the text on the tab it'sself so the user knows...
8
by: Aaron Ackerman | last post by:
If I am expanding (maximizing a form how do I maximize the tab control along with it?
2
by: Jeff C | last post by:
Hello all. Please please help me come up with a solution to this problem. Here it goes- --- code snipit--- 'TabControl1 ' Me.TabControl1.Anchor = System.Windows.Forms.AnchorStyles.Left...
5
by: Alien2_51 | last post by:
I have a problem with a ListBox control that is on a TabControl, it seems to be forgetting which items are selected in the list when I tab off the current tab, here's my winform code... I even...
2
by: michael sorens | last post by:
After extensive searching of the docs, I find no mention of support for Ctrl-Tab and Ctrl-Shift-Tab to navigate among tabs in a TabControl. I am surprised that such a common/standard keyboard...
8
by: nirdeshonline | last post by:
Hi, I have added a simple listbox in windows form under c# 2.0. It contains a collection of approx 10 strings as list items. Now when i resize the form whole listbox flickers. Please tell me...
3
by: Jeff | last post by:
..NET 2.0 I've created a window consisting of a treeview control and a tabcontrol. When a leave in the treeview is clicked then the code should check if the specific tabpage already exists in...
4
by: Steve | last post by:
Hi All Is there any way to change the colour of the Tabcontrol Tab header strip I have found how to override the individual Tab header colours in the drawitem event but the rest of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.