Hi,
I'm trying to create a procedure like this one:
protected Boolean test(object C, string id) {
if (C.FindControl(id) is Label)
{
return true;
}
}
I'm getting this error "Error 1 'object' does not contain a definition for
'FindControl' "
This code is working fine with VB. Does anyone knows how to fix this?
Regards,
Alex 5 1526
Alex Sauceda <al**@email.comwrote:
I'm trying to create a procedure like this one:
protected Boolean test(object C, string id) {
if (C.FindControl(id) is Label)
{
return true;
}
}
I'm getting this error "Error 1 'object' does not contain a definition for
'FindControl' "
This code is working fine with VB.
Only with Option Strict Off, I suspect.
Does anyone knows how to fix this?
What type are you expecting C to be? Cast it to that type, or change
your method to take the appropriate type in the first place.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
I want to pass a webcontrol like a panel or a repeateritem so I can look for
a control contained inside the object.
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
Alex Sauceda <al**@email.comwrote:
>I'm trying to create a procedure like this one:
protected Boolean test(object C, string id) { if (C.FindControl(id) is Label) { return true; } }
I'm getting this error "Error 1 'object' does not contain a definition for 'FindControl' "
This code is working fine with VB.
Only with Option Strict Off, I suspect.
>Does anyone knows how to fix this?
What type are you expecting C to be? Cast it to that type, or change
your method to take the appropriate type in the first place.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Use the base type for controls; Control, intead of Object. The
FincControl method is defined in the Control class, so you can use it
regardless of the actual class of the control.
Alex Sauceda wrote:
I want to pass a webcontrol like a panel or a repeateritem so I can look
for a control contained inside the object.
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP************************@msnews.microsoft.c om...
>Alex Sauceda <al**@email.comwrote:
>>I'm trying to create a procedure like this one:
protected Boolean test(object C, string id) { if (C.FindControl(id) is Label) { return true; } }
I'm getting this error "Error 1 'object' does not contain a definition for 'FindControl' "
This code is working fine with VB.
Only with Option Strict Off, I suspect.
>>Does anyone knows how to fix this?
What type are you expecting C to be? Cast it to that type, or change your method to take the appropriate type in the first place.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
--
Göran Andersson
_____ http://www.guffa.com
Great, thanks a lor for your help!
"Göran Andersson" <gu***@guffa.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Use the base type for controls; Control, intead of Object. The FincControl
method is defined in the Control class, so you can use it regardless of
the actual class of the control.
Alex Sauceda wrote:
>I want to pass a webcontrol like a panel or a repeateritem so I can look for a control contained inside the object.
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message news:MP************************@msnews.microsoft. com...
>>Alex Sauceda <al**@email.comwrote: I'm trying to create a procedure like this one:
protected Boolean test(object C, string id) { if (C.FindControl(id) is Label) { return true; } }
I'm getting this error "Error 1 'object' does not contain a definition for 'FindControl' "
This code is working fine with VB.
Only with Option Strict Off, I suspect.
Does anyone knows how to fix this?
What type are you expecting C to be? Cast it to that type, or change your method to take the appropriate type in the first place.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
--
Göran Andersson
_____ http://www.guffa.com
Alex Sauceda <al**@email.comwrote:
Great, thanks a lor for your help!
And as an aside, I *strongly* recommend that you turn Option Strict On
in your VB.NET code apart from occasions where it's helpful to have
weak typing (e.g. Office interop). It's faster as well as being more
type-safe, and you'll have Intellisense to help you.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Phil Powell |
last post by:
if (is_array($_POST)) {
foreach ($this->getAssocSectionsObjArray($key, $dbAP) as
$obj) {
print_r($obj); print_r(" in array? ");
print_r(in_array($obj, $result)); print_r("<P>");
if...
|
by: A |
last post by:
Hi,
I have always been taught to use an inialization list for initialising data
members of a class. I realize that initialsizing primitives and pointers use
an inialization list is exactly the...
|
by: marktm |
last post by:
Hi-
I am trying to use setInterval to call a method within an object and
have not had any luck. I get "Object doesn't support this property or
method" when I execute the following code. What I...
|
by: VK |
last post by:
Hello,
In my object I have getDirectory() method which returns 2-dimentional
array
(or an imitation of 2-dimentional array using two JavaScript objects
with auto-handled length property - please...
|
by: Mike Carroll |
last post by:
I have a COM server that's generally working ok. But one of its methods,
when the IDL gets read by the Intertop layer, has parameters of type "out
object".
The C# compiler tells me that it...
|
by: Christoph Boget |
last post by:
Please forgive my ignorance as I'm still new to developing w/C#
(and in windows in general). So if I use the wrong terms, please
bear with me.
I'm using VS.NET and defining the events have been...
|
by: yb |
last post by:
Hi,
Is there a standard for the global 'window' object in browsers? For
example, it supports methods such as setInterval and clearInterval, and
several others.
I know that w3c standardized...
|
by: xllx.relient.xllx |
last post by:
Assuming compiler optimizations are set to off, specifically to not
allow the compiler to elide the copy constructor, would the following
hold true?:
If you call a function with an user-defined...
|
by: Astley Le Jasper |
last post by:
Sorry for the numpty question ...
How do you find the reference name of an object?
So if i have this
bob = modulename.objectname()
how do i find that the name is 'bob'
|
by: tlhintoq |
last post by:
I'm pretty sure this is language independent and is going to be the same whether it's VC or C# - but my project is C# WIndows Forms just in case.
Does anyone have a good handle on the sequence of...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
| |