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

Q: controls in a panel

Hi

I have added a panel to a form and in this panel have added some controls
e.g. Button1

The only way I can see to access this button is as follows:

Dim index As Integer = Me.Panel1.Controls.IndexOf(Button1)
CType(Me.Panel1.Controls.Item(index), System.Windows.Forms.Button).Enabled =
True

Is there an easier way to do this? It seems a lot of typing!

Also, the button seems to be disabled even if this code is used; although it
is visible. Can anybody help?

Thanks in advance

Geoff
Nov 21 '05 #1
3 1273
Geoff,

This is strange, the button should be directly reachable with "button1"

In you situation I would delete it from the form it and drag it again on the
panel.

I hope this helps?

Cor

"Geoff Jones" <ge***@NODAMNSPAM.com>
Hi

I have added a panel to a form and in this panel have added some controls
e.g. Button1

The only way I can see to access this button is as follows:

Dim index As Integer = Me.Panel1.Controls.IndexOf(Button1)
CType(Me.Panel1.Controls.Item(index), System.Windows.Forms.Button).Enabled
=
True

Is there an easier way to do this? It seems a lot of typing!

Also, the button seems to be disabled even if this code is used; although
it
is visible. Can anybody help?

Thanks in advance

Geoff

Nov 21 '05 #2
"Geoff Jones" <ge***@NODAMNSPAM.com> schrieb:
I have added a panel to a form and in this panel have added some controls
e.g. Button1

The only way I can see to access this button is as follows:

Dim index As Integer = Me.Panel1.Controls.IndexOf(Button1)
CType(Me.Panel1.Controls.Item(index), System.Windows.Forms.Button).Enabled
=
True

Is there an easier way to do this? It seems a lot of typing!


LOL! You first determine the index of the button by already having a
reference to it and then get back the reference by a lookup by index. You
can replace the code above with this:

\\\
Me.Button1.Enabled = True
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
D'OH! LOL

Thanks guys

Geoff

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:u8**************@TK2MSFTNGP10.phx.gbl...
"Geoff Jones" <ge***@NODAMNSPAM.com> schrieb:
I have added a panel to a form and in this panel have added some controls e.g. Button1

The only way I can see to access this button is as follows:

Dim index As Integer = Me.Panel1.Controls.IndexOf(Button1)
CType(Me.Panel1.Controls.Item(index), System.Windows.Forms.Button).Enabled =
True

Is there an easier way to do this? It seems a lot of typing!


LOL! You first determine the index of the button by already having a
reference to it and then get back the reference by a lookup by index. You
can replace the code above with this:

\\\
Me.Button1.Enabled = True
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4

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

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
3
by: Roger | last post by:
Hi In a Windows forms application I have 2 forms A and B; Form B inherits from form A. Form A is never displayed and its only purpose is to be inherited from and therefore contains mostly...
1
by: sleigh | last post by:
Hello, I'm building a web application that will build a dynamic form based upon questions in a database. This form will have several different sections that consist of a panel containing one to...
0
by: mawi | last post by:
Hello, Description: I create panels with some controls on a page using a new panel button. One of the controls on each panel is the "close panel" button that is supposed to close the panel it...
2
by: Michael | last post by:
Need some help trying to read values from web controls - specifically *finding* the controls (like a drop down list) - that are added dynamically added within an asp:panel control. The page...
2
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the...
6
by: dhnriverside | last post by:
Hi peeps, I'm trying to create some controls textboxes at runtime, based on the number of items in a IETreeView that are checked. That I can do, I've got a place holder and I can create the...
4
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event....
0
by: Joachim | last post by:
Hello, I have a problem with dynamical creation of controls on a WebPage. The program works with the VS 2003 envrionment but not with the VS 2005 8.0.50215.44. To demonstrate it, I have make a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.