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

Me.Controls(0) vs. Me.Controls(1)

Joe
Hello All:

Does anyone know what Me.Controls(0) refers to? I know that Me.Controls(1)
refers to the form. Is Me.Controls(0) the Page?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
Nov 19 '05 #1
5 1506
You could add a breakpoint in Page_Load and add a watch on the object.

It's a literal control. It contains (typically) everything from the top of
the page to the <body> tag. Here's a sample:

\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
\r\n<HTML>\r\n <HEAD>\r\n <title>index</title>\r\n </HEAD>\r\n <body>\r\n

ASP.Net parses pure HTML elements (ie, non-ASP.Net elements) into
LiteralControls. This is why you shouldn't reference things ordinally.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:A8**********************************@microsof t.com... Hello All:

Does anyone know what Me.Controls(0) refers to? I know that Me.Controls(1)
refers to the form. Is Me.Controls(0) the Page?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #2
Joe
Hi Karl,

I reied to do some poking about in the Command- Immediate window and wasn't
able to find anything out. This helps.

I agree; I would not usually use ordinals but don't know what else s
available in this case. What else would you suggest for me to get a refernce
to the "Form control" other than Me.Controls(1) since controls only takes an
integer as it's argument?

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Karl Seguin" wrote:
You could add a breakpoint in Page_Load and add a watch on the object.

It's a literal control. It contains (typically) everything from the top of
the page to the <body> tag. Here's a sample:

\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
>\r\n<HTML>\r\n <HEAD>\r\n <title>index</title>\r\n </HEAD>\r\n

<body>\r\n

ASP.Net parses pure HTML elements (ie, non-ASP.Net elements) into
LiteralControls. This is why you shouldn't reference things ordinally.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:A8**********************************@microsof t.com...
Hello All:

Does anyone know what Me.Controls(0) refers to? I know that Me.Controls(1)
refers to the form. Is Me.Controls(0) the Page?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #3
Well, you can give the form an id and use:

dim form as HtmlForm = ctype(Page.FindControl("Form1"), HtmlForm)

or, the most logical, you can simply declare your form as you would other
controls

public class MyPage
Inherits Page
protected form1 as HtmlForm

sub Page_Load
form1.XX
end sub
end class

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:C6**********************************@microsof t.com...
Hi Karl,

I reied to do some poking about in the Command- Immediate window and
wasn't
able to find anything out. This helps.

I agree; I would not usually use ordinals but don't know what else s
available in this case. What else would you suggest for me to get a
refernce
to the "Form control" other than Me.Controls(1) since controls only takes
an
integer as it's argument?

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Karl Seguin" wrote:
You could add a breakpoint in Page_Load and add a watch on the object.

It's a literal control. It contains (typically) everything from the top
of
the page to the <body> tag. Here's a sample:

\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
>\r\n<HTML>\r\n <HEAD>\r\n <title>index</title>\r\n </HEAD>\r\n

<body>\r\n

ASP.Net parses pure HTML elements (ie, non-ASP.Net elements) into
LiteralControls. This is why you shouldn't reference things ordinally.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:A8**********************************@microsof t.com...
> Hello All:
>
> Does anyone know what Me.Controls(0) refers to? I know that
> Me.Controls(1)
> refers to the form. Is Me.Controls(0) the Page?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #4
Joe
Thanks.
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Karl Seguin" wrote:
Well, you can give the form an id and use:

dim form as HtmlForm = ctype(Page.FindControl("Form1"), HtmlForm)

or, the most logical, you can simply declare your form as you would other
controls

public class MyPage
Inherits Page
protected form1 as HtmlForm

sub Page_Load
form1.XX
end sub
end class

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:C6**********************************@microsof t.com...
Hi Karl,

I reied to do some poking about in the Command- Immediate window and
wasn't
able to find anything out. This helps.

I agree; I would not usually use ordinals but don't know what else s
available in this case. What else would you suggest for me to get a
refernce
to the "Form control" other than Me.Controls(1) since controls only takes
an
integer as it's argument?

Thanks,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
"Karl Seguin" wrote:
You could add a breakpoint in Page_Load and add a watch on the object.

It's a literal control. It contains (typically) everything from the top
of
the page to the <body> tag. Here's a sample:

\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
>\r\n<HTML>\r\n <HEAD>\r\n <title>index</title>\r\n </HEAD>\r\n
<body>\r\n

ASP.Net parses pure HTML elements (ie, non-ASP.Net elements) into
LiteralControls. This is why you shouldn't reference things ordinally.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:A8**********************************@microsof t.com...
> Hello All:
>
> Does anyone know what Me.Controls(0) refers to? I know that
> Me.Controls(1)
> refers to the form. Is Me.Controls(0) the Page?
>
> TIA,
> --
> Joe
>
> VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


Nov 19 '05 #5
the Me.Controls is the collection of controls to be rendered on the page.
Control[0] will be markup before the first server control (which is
converted to a literal control), Control[1] will be the first server control
on the page, often but not always the form.

-- bruce (sqlwork.com)

"Joe" <jo******@donotspam.yahoo.com> wrote in message
news:A8**********************************@microsof t.com...
Hello All:

Does anyone know what Me.Controls(0) refers to? I know that Me.Controls(1)
refers to the form. Is Me.Controls(0) the Page?

TIA,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation

Nov 19 '05 #6

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

Similar topics

16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
0
by: Mark Johnson | last post by:
Sometimes Controls that have been added to a GroupBox do not show up. What I am doing : 1) I am not using the designer, but create all the Controls per hand: groupBoxProdukt_01 = new...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
15
by: Arpan | last post by:
Consider the following code which retrieves data from a SQL Server 2005 DB table & displays it in a DataGrid: <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.