Using .Net Compact Framework, I have an ImageButton control (derived from the
Button control) this is wired to a click event. The click event's receives
the standard arguments (sender, e). How is it possible from within the click
event function to get the "name" property of the control? For example:
ImageButton ImageButton1 = new ImageButton();
ImageButton1.Cl ick += new System.EventHan dler(ImageButto n1_Click);
.... code
private void ImageButton1_Cl ick(object sender, System.EventArg s e)
{
string name = ((ImageButton)s ender).name???
}
Thanks, 7 14479
Doesn't your code work?
private void ImageButton1_Cl ick(object sender, System.EventArg s e)
{
string name = ((ImageButton)s ender).Name;
}
No. In the VS .NET 2003, i get the error: 'System.ImageBu tton' does not
contain a definition for 'Name'. I've tried this w/ more conventional
controls, like the Button control, and i get: 'System.Windows .Forms.Button'
does not contain a definition for 'Name'
??
"sadhu" wrote: Doesn't your code work?
private void ImageButton1_Cl ick(object sender, System.EventArg s e) { string name = ((ImageButton)s ender).Name; }
It doesn't look as if the ImageButton has a Name property. Have you
tried the ID property? Will that work for you?
Just a thought.
There is no "ID" property either. This is quite strange as in "design mode" i
can set such properties...
"Chris Dunaway" wrote: It doesn't look as if the ImageButton has a Name property. Have you tried the ID property? Will that work for you?
Just a thought.
Are you sure you are using Name (typed in the correct case)? Remember,
C# is case sensitive.
The Button class does have a Name property, in fact, if you read
through the InitializeCompo nent() method in your form class, you'll see
that it actually sets the Name to whatever you typed in the UI. The
Name property is defined in the Control base class, and so should be
available to all controls.
Regards
Senthil
Yes, the "Name" value is properly typed. I'm not an expert, but my
ImageButton class (which i downloaded from some spot on the Web) is not
derived from the Button class, but instead from the "Control" class. At
least, i think this is so. The code reads:
public class ImageButton : Control
{
// ... code
}
In the Compact Framework, there is no "ImageButto n" as there is in the
complete .Net Framework. And, i believe that the actual image that appears on
the screen is derived from the system.drawing. image class.
Does this make it easier for anyone to answer my question? Thanks.
"sadhu" wrote: Are you sure you are using Name (typed in the correct case)? Remember, C# is case sensitive.
The Button class does have a Name property, in fact, if you read through the InitializeCompo nent() method in your form class, you'll see that it actually sets the Name to whatever you typed in the UI. The Name property is defined in the Control base class, and so should be available to all controls.
Regards Senthil
You have the code? Then why don't you add a Name property to it? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ST |
last post by:
Hi,
I'm new to vb.net programming, and I keep getting this error: Name
'GetQuery' is not declared. I can't figure out why?? It seems like I have
the right references/namespaces. This is my code below. Also, can someone
explain to me what the ContentHandlerImpl.vb file actually does? It's in
this project that I'm working with...but I'm not sure what the file actually
does. Thanks!!
Imports System.Xml
Imports Lucene.Net.Documents
|
by: Java script Dude |
last post by:
We just discovered another IE bug.
When an html form contains an element with a name of `name` IE's
internal index screws up the .name property of the containing form to
point to the bad element object instead of containing the string name
property of the form.
Here is the simplified test case:
<html>
|
by: Marc Elser |
last post by:
Hi Everybody,
Can someone please tell me how to access the form name if there's a form
field named "name", for example:
<form name="myform">
<input type="text" name="name" value="Marc">
<input type="button" onClick="alert(this.form.name);">
</form>
|
by: Pavils Jurjans |
last post by:
Hello,
I have bumped upon this problem: I do some client-side form processing
with JavaScript, and for this I loop over all the forms in the
document. In order to identify them, I read their "name" property
(which sources from "name" HTML attribue). The problem is, that if the
form contains form control named "name", it overwrites the form name
property. In fact, I'm quite surprised that it's so easy to spoil any
of the form object...
|
by: Mark Kamoski |
last post by:
Hi Everyone--
How can one to make a "select directory name" dialog?
It would be great if one could use the FileOpenDialog but it does not seem
to be straight-forward.
Anyway, if you have any hints or otherwise, please send them along.
Thank you.
| |
by: engsolnorm |
last post by:
I'm playing with a sudoku GUI...just to learn more about python.
I've made 81 'cells'...actually small canvases
Part of my scheme to write the cells (all 81 of them in the gui) to a file (using the the SAVE callback/button), then
restore the gui cells from the contents of the saved file, which depends on knowing the "name" of the cell with the
focus, or one (or more) which have a number.
The print shows .9919624.9990312, but this...
|
by: ajschuster |
last post by:
I cannot get my Javascript to work in Firefox. I am just trying to
access the .name property of a DIV tag but it keeps coming back as
"undefined". The same code works in IE and it works in Safari.... and
if I change it to .id instead of .name it can read that so why wouldn't
it be able to read the .name?
I need urgent help!! Here's my code....
|
by: Dick Watson |
last post by:
I had a page that works when setup like this:
===
<form name="frmCalc" action="">
<script type="text/javascript">
function btnCalc_onclick(abc) {
return "got here with " + abc;
}
|
by: |
last post by:
I'd like to change the "Product name" property on a (Win32) DLL - AFTER it's
been built. Basically, I have a post-processing tool that modifies the DLL
in a way that can't easily be detected. I want to tag files that have been
modfied in this way so that we can right-click on them later and know that
they've been modified.
How could I write a little app that I could run in a build script to do
this?
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |