Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > Visual Studio 2008
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 26th, 2009, 04:25 AM
Registered User
 
Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question Real beginner question

I am just starting to use VS 2008, Visual Basic. When I double click a button I get a procedure like:

Code:
     Private Sub mnuFilePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrint.Click
           End Sub
Now if I want to make a call to this procedure what do I use for arguments?

I have tried
Code:
 Private Sub cmdPrintResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrintResults.Click
        mnuFilePrint_Click()
    End Sub
but I get a error messages like

"argument not specified for parameter 'e' of . . . "
and "argument not specified for parameter 'sender' of . . . "

Please help
Reply With Quote
  #2 (permalink)  
Old December 26th, 2009, 04:29 AM
Imar's Avatar
Wrox Author
Points: 66,617, Level: 100
Points: 66,617, Level: 100 Points: 66,617, Level: 100 Points: 66,617, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,123
Thanks: 65
Thanked 1,386 Times in 1,366 Posts
Default

Hi there,

You typically don't call these event handlers directly as they are designed to handle a specific event (e.g. a Button's Click) called by the runtime or based on some user action. Instead, you can create a method that contains the code you typically have in the handler and call that method instead. E.g.:

Code:
 
Private Sub mnuFilePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFilePrint.Click
  PrintStuff()
End Sub
 
Private Sub cmdPrintResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrintResults.Click
  PrintStuff()
End Sub
 
Private Sub PrintStuff()
  ' Do here what you previously did in mnuFilePrint_Click
End Sub
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old December 26th, 2009, 12:19 PM
Registered User
 
Join Date: Dec 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thank You

That fixes my problem.

Thank You

Jerry
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
a question from a beginner starnold BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 1 June 18th, 2009 10:36 AM
Question for the real tech lords. Warbird General .NET 2 November 10th, 2005 08:51 PM
Beginner Question dkr72 Excel VBA 1 January 18th, 2005 08:37 AM
beginner question saudyonline General .NET 2 September 21st, 2004 01:56 AM
PHP real question jimmychuck BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 September 14th, 2004 11:58 AM



All times are GMT -4. The time now is 03:03 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.