473,956 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re Run method in another windows form?

GetInstalledPri nters do not requires 2 parameters.

SP,

Basically make sure that your event handler method getCurrentPrint ers has
signature of (object, EventArgs e)

Thanks,
Ashish

"SP" <egatsecneserp( reverse)@hotmai l.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
<ri************ @orcon.net.nz> wrote in message
news:10******** **************@ c13g2000cwb.goo glegroups.com.. .
Justin,
I thought monday morning may help me but alas not. This is what I have
so far along the lines you suggested so I hope you can have a quick
check for me. It won't compile - it tells me that getCurrentPrint ers()
does not match delegate - void System.EventHan dler(object,
System.EventArg s)

public class FormA : Form {
private void lnkAdd_LinkClic ked(object sender,
System.Windows. Forms.LinkLabel LinkClickedEven tArgs e)()
{
AddPrinter addform = new AddPrinter();
addform.DataUpd ated += new EventHandler(ge tCurrentPrinter s);
addform.Show();
}

private void GetInstalledPri nters()
{
// do stuff
}
}

and in formB

public class AddPrinter : Form
{
public event EventHandler DataUpdated;

private void OnDataUpdated(E ventArgs e)
{
if ( DataUpdated != null )
{
DataUpdated(thi s, e);
}
}

public void btnAdd_Click(ob ject sender, System.EventArg s e)
{
OnDataUpdated(e );
this.Close();
}
}


The error message is correct. The getInstalledPri nters requires 2
parameters (object sender, EventArgs e). When using delegates the VS IDE
will create the function for you to avoid these mistakes. After typing
"addform.DataUp dated +=" you press Tab once to create the "new
EventHandler" and the second tab will create the function with the correct
parameters.

SP


Nov 16 '05 #1
0 1183

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

Similar topics

4
3570
by: mickbw | last post by:
I am unable to display PHP pages generated by a submission of a form using a POST method. To illustrate this, I created a very simple form called TestForm.php . <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
3
11484
by: news.onetel.net.uk | last post by:
I and my friend Karl have spent literally all day trying to find out what is causing my error but we are zapped of any further functionality :) I have a form that adds news records. You select 'City' then you select 'Business Category' - now when you select 'Business Category' the next drop-down menu (business sub category) should populate with 'Business Sub-categories' related to the 'Business Category' but once 'Business Category' is...
2
2946
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server where there is no scripts allowed running (the software is from Opentext called Livelink)- therefore I need javascript to do the tasks listed below: 1. validate the form - this has been completed 2. pop up another window that will go ahead and...
1
2339
by: Dan | last post by:
Good Day, I have a Windows Service that is responsible for processing somes files. One method of the service invokes another method which may take a while to complete its work. Something like this pulbic class A { public void ProcessFile()
12
13168
by: ritchiebuckley | last post by:
I've been doing asp.net for so long now that I have forgotten about windows form programming so excuse this (seemingly) basic question. I have a form A which then opens up form B. I do stuff on form B after which I hit a close button. I want to run a method on form A as I close form B. I don't need to pass data back (though I like to know how this is done), just run a refresh type method back on form B. I've got bogged down in...
6
2693
by: Mike | last post by:
Hi, I have such problem: On my form I have TabControl. I want to move from one tab to another using "Next" and "Prev" button. This part works fine. But control also supports switching between TabPagess using combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I would like to suppress such possibility.
33
1909
by: Partha Protim Roy | last post by:
Hello, I have a Customer form say A to enter/update customer details. In the Form A I have a button which opens another form say B. In the Form B, I am providing user with a option to search Customer from the database depending on various search criteria. On matching the criteria, list of Customer is displayed in the datagrid.
0
1346
by: graciezzzzz | last post by:
Hi all, I create a Web Service project called 'eSelectService' and another Class Library project called 'MonerisVO', and a Windows Form project called 'maps' as well. The reason why I need the Class Library project is because I don't want to pass more than 30 parameters when I try to invoke the Web Method. I used the class in Class Library as a value object to contain all the information I need.
5
1816
by: Ronin | last post by:
I need a little help trying to figure out the last piece of this puzzle. I've got a form with an associated toolbox that will allow a user to drag a control off the toolbox and drop it onto the form. The form instantiates the control using the Activator.CreateInstance method. What I then need to do (and the part I have not figured out) is how to attach a method from that control (a custom data refresh method) to a timer.elapsed...
5
2543
by: lukasmazur | last post by:
Hi I have a problem with using listBox1. I have a two forms form1 and form2. In form1 are controls listBox1, textBox1 and button witch creating object of class Form2. In class Form2 I create a pointer to object of class Form1. I don't known how to use method add(), where can I find it. From Form1 I can add value like this this->listBox1- I cant find it. I have textBox1 on Form1 and I can change text in this control like this ...
0
10226
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10031
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,...
0
11654
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, 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...
0
11265
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 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...
0
10746
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9955
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, 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...
1
5013
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
2
4602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3606
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.