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

Parameter problem

3
Hi all,

I have this problem,

I want to return certain value's from a method.
And that method has a parameter.

And i want to use that return value in a
other method, but it i dont have the
correct parameters for the method.

Example.
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  
  4.  private void button1_Click(object sender, EventArgs e)
  5.  {
  6.  click(e);
  7.  
  8.  }
  9.  
  10.  
  11. public Point click(MouseEventArgs e)
  12. {
  13.  
  14. Point p = new Point(e.X, e.Y);
  15.  
  16. return p;
  17.  
  18. }
  19.  
  20. public void get()
  21. {
  22.  
  23. point l = click(); //this wont work because i need a parameter, but i dont have one. Because i only want to have the value of e.X and e.Y
  24.  
  25. }
  26.  
  27.  
  28.  


BTW, i am a Noob , ;)

Thank you..

WIvked
Sep 16 '10 #1
1 1189
Plater
7,872 Expert 4TB
Put the code you want to run in your own function, then you can call that function from anywhere.

For example:
Expand|Select|Wrap|Line Numbers
  1. private void ReloadDataButton_Click(object sender, EventArgs e)
  2. {
  3.     ReloadData();
  4. }
  5.  
  6. private void ReloadData()
  7. {
  8. //do stuff to reload the data here
  9. }
  10.  
Now I can call ReloadData() from anywhere (I call it when my form loads and whenever the button is clicked)
Sep 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

49
by: Mark Hahn | last post by:
As we are addressing the "warts" in Python to be fixed in Prothon, we have come upon the mutable default parameter problem. For those unfamiliar with the problem, it can be seen in this Prothon...
1
by: Norma | last post by:
I am only posting this again because I did not get any responses the first time I posted it. Excuse me for being redundant here but I can't figure this one out. Original Post: I am trying to...
1
by: mei xiao | last post by:
Hi, In my web service method (written in C#), I have a method like public string myMethod(out int test1, string test1) but when I use a web client to access this method, I got a run time...
5
by: Lasse Edsvik | last post by:
Hello I have this: public SqlParameter GetParameter(string sqlparam) { SqlParameter param = cmd.Parameters.Add(sqlparam);
1
by: Kapil Shah via DotNetMonster.com | last post by:
Hello everybody, I am trying to create a web application to generate Crystal Report with Parameters. However I noticed that ReportDocument.Load is used twice when the parameter page is loaded ....
3
by: Ross McLean | last post by:
Hi all, I've been teaching myself C# for a new project at work. I have a bit of a background in c++ and java but never been what you could call a guru. I'm having some strange things happening...
1
by: rosie2006 | last post by:
Environment: .net2.0 over oracle Problem? a simple select statement within a DetailsView that gets two parameter values from a GridView SelectedValue. It might be valuable to understand that to...
4
by: MarkTingson | last post by:
Hi guys, Is there a way to prevent "Enter Parameter Values" message box to pop during VB6 program runtime?I have created a program in VB6 that uses a Crystal report control. When I put a...
8
by: DanicaDear | last post by:
I have something interesting...looking to see if anyone else has came across this. I have a query with parameter and and the query works beautifully every time. However, when I use the wizard...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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,...
0
isladogs
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...

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.