473,406 Members | 2,439 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,406 software developers and data experts.

Accessing Properties within a Panel

In VB 2K5 Express I've created a panel named "Configure" with eight
label, and eight combobox controls; and finally a button named
"Apply."

The label controls are sequentially named Channel0 through Channel7,
and the combobox controls are sequentially named Ch0 through Ch7,
accordingly.

Each combobox contains four items out of which one must be selected.
For example, lets say we choose Channel3 and the corresponding combox
box drops down with these choices:

Analog
State
Counter
Pdm

After any or all Channels have been configured, I want to use the
Apply button's click event to process the selections.

My question is, "From within the APPLY buttons click event code, how
can I determine what item each of the eight combobox controls contain?

(I'm kind of thinking in terms of finding some way to index through
each of the comboboxes using a loop structure, but I don't see any
index value for the combobox controls in the panel.)

Thanks for helping this novice.

Apr 3 '06 #1
4 1210
Ally,

Combobox.text (do not forget to set them initial to Selectedinded = 0)
As well to set them to dropdownlist

I hope this helps,

Cor
<ally> schreef in bericht news:8c********************************@4ax.com...
In VB 2K5 Express I've created a panel named "Configure" with eight
label, and eight combobox controls; and finally a button named
"Apply."

The label controls are sequentially named Channel0 through Channel7,
and the combobox controls are sequentially named Ch0 through Ch7,
accordingly.

Each combobox contains four items out of which one must be selected.
For example, lets say we choose Channel3 and the corresponding combox
box drops down with these choices:

Analog
State
Counter
Pdm

After any or all Channels have been configured, I want to use the
Apply button's click event to process the selections.

My question is, "From within the APPLY buttons click event code, how
can I determine what item each of the eight combobox controls contain?

(I'm kind of thinking in terms of finding some way to index through
each of the comboboxes using a loop structure, but I don't see any
index value for the combobox controls in the panel.)

Thanks for helping this novice.

Apr 4 '06 #2

<ally> wrote in message news:8c********************************@4ax.com...
In VB 2K5 Express I've created a panel named "Configure" with eight
label, and eight combobox controls; and finally a button named
"Apply."

The label controls are sequentially named Channel0 through Channel7,
and the combobox controls are sequentially named Ch0 through Ch7,
accordingly.

Each combobox contains four items out of which one must be selected.
For example, lets say we choose Channel3 and the corresponding combox
box drops down with these choices:

Analog
State
Counter
Pdm

After any or all Channels have been configured, I want to use the
Apply button's click event to process the selections.

My question is, "From within the APPLY buttons click event code, how
can I determine what item each of the eight combobox controls contain?

(I'm kind of thinking in terms of finding some way to index through
each of the comboboxes using a loop structure, but I don't see any
index value for the combobox controls in the panel.)

Thanks for helping this novice.


You can iterate through the controls on the Panel using the following:
(warning: Air code - not tested)

For Each cal as Control In Configure.Controls
If TypeOf cal is ComboBox Then

'Do whatever you need to do with the ComboBoxes.

End If
Next

I hope this helps.

--
Al Reid
Apr 4 '06 #3

Al Reid wrote:
<ally> wrote in message news:8c********************************@4ax.com...
In VB 2K5 Express I've created a panel named "Configure" with eight
label, and eight combobox controls; and finally a button named
"Apply."

The label controls are sequentially named Channel0 through Channel7,
and the combobox controls are sequentially named Ch0 through Ch7,
accordingly.

Each combobox contains four items out of which one must be selected.
For example, lets say we choose Channel3 and the corresponding combox
box drops down with these choices:

Analog
State
Counter
Pdm

After any or all Channels have been configured, I want to use the
Apply button's click event to process the selections.

My question is, "From within the APPLY buttons click event code, how
can I determine what item each of the eight combobox controls contain?

(I'm kind of thinking in terms of finding some way to index through
each of the comboboxes using a loop structure, but I don't see any
index value for the combobox controls in the panel.)

You're wondering what happened to control arrays, right?
You can iterate through the controls on the Panel using the following:
(warning: Air code - not tested)

For Each cal as Control In Configure.Controls
If TypeOf cal is ComboBox Then

'Do whatever you need to do with the ComboBoxes.

End If
Next


That works. Or, you can even create your own control array! Remember,
Control is a class like any other, so there's nothing stopping us
creating an array of Control, or even of ComboBox:

'at form level
Private panelCombos() As ComboBox

'at form Load
panelCombos = New Combobox() { Ch0, Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7 }

'when we want to read the values
Dim iCombo As Integer
For iCombo = 0 To panelCombos.Length - 1
DoSomethingWith panelCombos(i).SelectedItem
Next

--
Larry Lard
Replies to group please

Apr 4 '06 #4
On 4 Apr 2006 07:51:51 -0700, "Larry Lard" <la*******@hotmail.com>
wrote:

Al Reid wrote:
<ally> wrote in message news:8c********************************@4ax.com...
> In VB 2K5 Express I've created a panel named "Configure" with eight
> label, and eight combobox controls; and finally a button named
> "Apply."
>
> The label controls are sequentially named Channel0 through Channel7,
> and the combobox controls are sequentially named Ch0 through Ch7,
> accordingly.
>
> Each combobox contains four items out of which one must be selected.
> For example, lets say we choose Channel3 and the corresponding combox
> box drops down with these choices:
>
> Analog
> State
> Counter
> Pdm
>
> After any or all Channels have been configured, I want to use the
> Apply button's click event to process the selections.
>
> My question is, "From within the APPLY buttons click event code, how
> can I determine what item each of the eight combobox controls contain?
>
> (I'm kind of thinking in terms of finding some way to index through
> each of the comboboxes using a loop structure, but I don't see any
> index value for the combobox controls in the panel.)


You're wondering what happened to control arrays, right?
You can iterate through the controls on the Panel using the following:
(warning: Air code - not tested)

For Each cal as Control In Configure.Controls
If TypeOf cal is ComboBox Then

'Do whatever you need to do with the ComboBoxes.

End If
Next


That works. Or, you can even create your own control array! Remember,
Control is a class like any other, so there's nothing stopping us
creating an array of Control, or even of ComboBox:

'at form level
Private panelCombos() As ComboBox

'at form Load
panelCombos = New Combobox() { Ch0, Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7 }

'when we want to read the values
Dim iCombo As Integer
For iCombo = 0 To panelCombos.Length - 1
DoSomethingWith panelCombos(i).SelectedItem
Next


Thanks, Al ... mission accomplished on that one. While speaking of
control arrays, I also need to create a "cellular" control array. In
this panel I have 8 rows by 5 columns and each cell has a textbox
control. So there are 8 * 5 = 40 cells. How could I modify your
technique to include a double dimension to fit this scenario? Namely
something like:

panelCombos = New Combobox(m,n) {textbox(m,n) }

is what I was thinking of, which is just a wild guess on my part.

Thank you very much for your insight!
Apr 5 '06 #5

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

Similar topics

6
by: John Bowman | last post by:
Hi, I have a C# app that needs to launch the "Add Scheduled Tasks" wizard found in the control panel "Scheduled Tasks" applet. I realize that this "applet" really just opens the tasks folder,...
3
by: Sam Sungshik Kong | last post by:
Hello! While using panel control, I wondered a thing. Panel class is subclass of Control class. Control class has KeyPress event and Focus() method, etc... Then Panel class must have them. I...
3
by: Craig G | last post by:
i have a user control which is basically a datagrid, which has add/edit/delete buttons on the grid is there anyway of accessing the actual datagrid from the form itself? basically i want to...
1
by: Charlie | last post by:
Hi: I'm laying out a hieraracical report by nesting repeater controls. I'm using panels to expand/collapse detail sections. To access a panel in a nested repeater, I use the following code. ...
8
by: dwok | last post by:
I have been wondering this for a while now. Suppose I have a class that contains some private member variables. How should I access the variables throughout the class? Should I use properties that...
3
by: Alex | last post by:
Hi all, I'm trying to create an arraylist of a user control class... I'm able to define the list and add objects (panels) to it, but I can access and of the panel properties using an index... ...
4
by: evantay | last post by:
I'm using ASP.NET 2.0 with VS.NET 2005. I'm trying to access properties from my master pages within a page that inherits from that master page (a child page). However the values are always null....
2
by: Rob | last post by:
I am not sure if this can be implemented.... There exists a TabContol (added at design time) to a form.. Tabs for this TabContol get added at run time. Usage of the following 2 properties...
8
by: GaryDean | last post by:
I have a Wizard page and need to affect the next and previous buttons from my code-behind. I've googled around and found two solutions, and neither appear to work. I can access the SideBarList...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.