473,666 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

invalid arguments

Hi,
I kind of got thrown into C# without any real programming experience, so I
know this is probably an easy question, but it's driving me crazy. In my
Tabs class, as I'm leaving a tabpage, I'm trying to capture the screen as a
bitmap. I'm trying to tell it to call the CaptureTab method from a class
called Print.
private void tabLeave(object sender, System.EventArg s e)
{
...
Print.CaptureTa b(System.Window s.Forms.Form frm);
}
but I get an error inside the parentheses - it's unhappy with frm and says )
expected. Then I erase the frm to get the 'System.Windows .Forms.Form'
denotes a 'class' where a 'variable' was expected error. Then I try just
(frm) and get The name 'frm' does not exist in the class or namespace
'HCAUT.Tabs'. Then when I use (this) I get An object reference is required
for the nonstatic field, method, or property
HCAUT.Print.Cap tureTab(System. Windows.Forms.F orm)'. I try (e) and get The
best overloaded method match for
'HCAUT.Print.Ca ptureTab(System .Windows.Forms. Form)' has some invalid
arguments. And finally I just leave it empty and get No overload for
method 'CaptureTab' takes '0' arguments.
(My CaptureTab method looks like this:
CaptureTab(Syst em.Windows.Form s.Form frm))

Anybody know what I can do to get this to work?

Thanks for any help!!!!
Melanie
Nov 17 '05 #1
2 2044
hi,

is this a compiler or runtime error?

from the little piece of code you posted it seems you have an extra closing
parentesis:
CaptureTab(Syst em.Windows.Form s.Form frm))

but I canont be sure unless you post the entire code.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"melanieab" <me*******@disc ussions.microso ft.com> wrote in message
news:64******** *************** ***********@mic rosoft.com...
Hi,
I kind of got thrown into C# without any real programming experience, so I
know this is probably an easy question, but it's driving me crazy. In my
Tabs class, as I'm leaving a tabpage, I'm trying to capture the screen as
a
bitmap. I'm trying to tell it to call the CaptureTab method from a class
called Print.
private void tabLeave(object sender, System.EventArg s e)
{
...
Print.CaptureTa b(System.Window s.Forms.Form frm);
}
but I get an error inside the parentheses - it's unhappy with frm and
says )
expected. Then I erase the frm to get the 'System.Windows .Forms.Form'
denotes a 'class' where a 'variable' was expected error. Then I try just
(frm) and get The name 'frm' does not exist in the class or namespace
'HCAUT.Tabs'. Then when I use (this) I get An object reference is
required
for the nonstatic field, method, or property
HCAUT.Print.Cap tureTab(System. Windows.Forms.F orm)'. I try (e) and get
The
best overloaded method match for
'HCAUT.Print.Ca ptureTab(System .Windows.Forms. Form)' has some invalid
arguments. And finally I just leave it empty and get No overload for
method 'CaptureTab' takes '0' arguments.
(My CaptureTab method looks like this:
CaptureTab(Syst em.Windows.Form s.Form frm))

Anybody know what I can do to get this to work?

Thanks for any help!!!!
Melanie

Nov 17 '05 #2
melanieab wrote:
Hi,
I kind of got thrown into C# without any real programming experience,
so I know this is probably an easy question, but it's driving me
crazy. In my Tabs class, as I'm leaving a tabpage, I'm trying to
capture the screen as a bitmap. I'm trying to tell it to call the
CaptureTab method from a class called Print.
private void tabLeave(object sender, System.EventArg s e)
{
...
Print.CaptureTa b(System.Window s.Forms.Form frm);
}
but I get an error inside the parentheses - it's unhappy with frm and
says ) expected. Then I erase the frm to get the
'System.Windows .Forms.Form' denotes a 'class' where a 'variable' was
expected error. Then I try just (frm) and get The name 'frm' does
not exist in the class or namespace 'HCAUT.Tabs'. Then when I use
(this) I get An object reference is required for the nonstatic
field, method, or property
HCAUT.Print.Cap tureTab(System. Windows.Forms.F orm)'. I try (e) and
get The best overloaded method match for
'HCAUT.Print.Ca ptureTab(System .Windows.Forms. Form)' has some invalid
arguments. And finally I just leave it empty and get No overload
for method 'CaptureTab' takes '0' arguments. (My CaptureTab method
looks like this:
CaptureTab(Syst em.Windows.Form s.Form frm))

Anybody know what I can do to get this to work?

Thanks for any help!!!!
Melanie


To start at the end:
The method definition "CaptureTab(Sys tem.Windows.For ms.Form frm)"
means: this is a method with name "CaptureTab ". It accepts a single parameter
of type "System.Windows .Forms.Form", which internally is called "frm".
By the way: you didn't specify a returntype, which is required (although
it can be "void", meaning "nothing returned").

When you call this method, you will have to supply a variable
of the correct type (System.Windows .Forms.Form), or one which is
derived from that type (some specific form definition in this case).
If you supply a variable, the only requirement is that the *type* matches,
the *name* is irrelevant.

When you write
Print.CaptureTa b(System.Window s.Forms.Form frm);
you are *declaring* a new variable (frm), but this is illegal at this point.
When you declare a variable, you only define a space where later
some real data is placed.

So you need to find some way to get a reference to the particular form
that you want to "CaptureTab ". Sort of:
System.Windows. Forms.Form myFrm;
myFrm = ??????
Print.CaptureTa b(myFrm);

If you have the tabLeave method inside a form, then you could use "this"
to supply the current form to your CaptureTab method.
either use
myFrm = this;
in the lines above, or just replace all three with
Print.CaptureTa b(this);

But this is pretty basic stuff, maybe you should find some "introducti on
to programming" book to get some basis.

Hans Kesting
Nov 17 '05 #3

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

Similar topics

2
2837
by: Andrew Dalke | last post by:
Out of curiosity, I tried passing using an invalid base for a class. I can't explain why I got the error messages I did. Can someone here enlighten me? # Here I'm just curious >>> def spam(a, b): .... return a+b .... >>> class Spam(spam):
30
5039
by: Tim Johansson | last post by:
I'm new to C++, and tried to start making a script that will shuffle an array. Can someone please tell me what's wrong? #include <iostream.h> #include <string.h> int main () { srand(time(0)); int array_length; int count;
4
3063
by: Gianluca | last post by:
This is the simplified code I'm trying to generate: ilg.DeclareLocal(typeof(int)); // define local integer Label exit = ilg.DefineLabel(); // define "exit" label ilg.Emit(OpCodes.Ldc_I4_0); // put 0 on the stack ilg.Emit(OpCodes.Stloc_0); // set the local integer to 0 ilg.Emit(OpCodes.Ldloc_0); // load the local integer (0) on the stack ilg.Emit(OpCodes.Ldc_I4_1); // load integer 1 on the stack
1
17035
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
1
8016
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL: http://(address.of.my.webcam):port/LiveView.html and
3
8698
by: Nathan Sokalski | last post by:
I am recieving the following error on the second postback of a page I have written: The state information is invalid for this page and might be corrupted Stack Trace: System.Convert.FromBase64String(String s) +0
2
2172
by: Nathan Sokalski | last post by:
I have a DataList in which the ItemTemplate contains two Button controls that use EventBubbling. When I click either of them I receive the following error: Server Error in '/' Application. -------------------------------------------------------------------------------- Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/in configuration or <%@ Page EnableEventValidation="true"...
9
4555
by: 200dogz | last post by:
Hi guys, I want to have a button which opens up a new window when pressed. <asp:Button ID="Button1" runat="server" Text="Open new window" /> ... Button1.Attributes.Add("OnClick",
4
23841
by: JamTech | last post by:
The Script Resource and the Web Resource files are generating intermittent errors in my application. I have been trying to chase the cause of the problem but to no avail. I notice that the “d” parameter that is passed is some how corrupted and I can’t for the life of me figure out what’s causing this parameter to be corrupted. I noticed that JavaScript code that in my application is some how getting intertwined with the hash code that’s...
0
8454
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
8785
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
7389
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
6200
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 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...
0
5671
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();...
0
4200
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...
1
2776
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
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.