473,395 Members | 1,464 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,395 software developers and data experts.

Re Run method in another windows form?

GetInstalledPrinters do not requires 2 parameters.

SP,

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

Thanks,
Ashish

"SP" <egatsecneserp(reverse)@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
<ri************@orcon.net.nz> wrote in message
news:10**********************@c13g2000cwb.googlegr oups.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 getCurrentPrinters()
does not match delegate - void System.EventHandler(object,
System.EventArgs)

public class FormA : Form {
private void lnkAdd_LinkClicked(object sender,
System.Windows.Forms.LinkLabelLinkClickedEventArgs e)()
{
AddPrinter addform = new AddPrinter();
addform.DataUpdated += new EventHandler(getCurrentPrinters);
addform.Show();
}

private void GetInstalledPrinters()
{
// do stuff
}
}

and in formB

public class AddPrinter : Form
{
public event EventHandler DataUpdated;

private void OnDataUpdated(EventArgs e)
{
if ( DataUpdated != null )
{
DataUpdated(this, e);
}
}

public void btnAdd_Click(object sender, System.EventArgs e)
{
OnDataUpdated(e);
this.Close();
}
}


The error message is correct. The getInstalledPrinters 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.DataUpdated +=" 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 1164

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

Similar topics

4
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...
3
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...
2
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...
1
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...
12
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...
6
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...
33
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...
0
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...
5
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...
5
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...
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...
0
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
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
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
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...
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...

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.