Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Optional Keyword ?


Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2002, 09:50 PM
Renidrag Renidrag is offline
Centurion
 
Join Date: Apr 2002
Location: Newfoundland
Posts: 123
Default Optional Keyword ?


Can someone tell me what is wrong here?
I am useing the optional keyword in my args list and since i have inserted them i am getting a Compile Error, it is saying that -->

Procedure declaration does not match description of event or procedure having the same name

Here is the code on form1 -- (this is the one that gets highlighted)
---------------------------------------------------------------------------------
Private Sub Sockets_OpenAdbConnection(intWhichInfo, Optional intIndex As Integer, Optional sUserN As String, Optional sUserP As String, Optional sUfriends As String)

Here is the code on form2
--------------------------------------------------------------------------------
Public Event OpenAdbConnection(ByVal intWhichInfo, ByVal intIndex As Integer, ByVal sUserN As String, ByVal sUserP As String, ByVal sUfriends As String)

*(Different calls to this procedure use different args)
__________________
- - Renidragd - -
Reply With Quote
  #2  
Old 06-22-2002, 10:19 PM
orufet's Avatar
orufet orufet is offline
Paranoid Coder

Retired Leader
 
Join Date: Mar 2001
Location: Canada
Posts: 2,716
Default

You cannot change the arguement list of an event.
Reply With Quote
  #3  
Old 06-22-2002, 10:27 PM
Renidrag Renidrag is offline
Centurion
 
Join Date: Apr 2002
Location: Newfoundland
Posts: 123
Default

do you mean where i left out the optional keyword in the event?
if so when i had it in there it gave me a Syntax Error
__________________
- - Renidragd - -
Reply With Quote
  #4  
Old 06-23-2002, 09:01 AM
Renidrag Renidrag is offline
Centurion
 
Join Date: Apr 2002
Location: Newfoundland
Posts: 123
Default

Can anyone tell me if i can use the *Optional Keyword* in an event argument parameter list?
__________________
- - Renidragd - -
Reply With Quote
  #5  
Old 06-23-2002, 09:24 AM
ChiefRedBull's Avatar
ChiefRedBull ChiefRedBull is offline
ISearchGoogle

Retired Moderator
* Expert *
 
Join Date: May 2001
Location: england
Posts: 6,321
Default

As orufet stated above, you cannot change objects event parameters. You have to go with the default ones that the object provides. If you change it, VB will complain. If you somehow managed to compile, it would crash.

Delete your sub declaration and select it from the combo boxes at the top of the code window in order to get the correct parameters.

In your own sub or functions, then yes it is perfectly ok to use the Optional keyword.
__________________
Chuck Norris ordered a Big Mac at Burger King, and got one.
Reply With Quote
  #6  
Old 06-23-2002, 09:28 AM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

No, you cannot use Optional with event subs.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #7  
Old 06-23-2002, 09:33 AM
Renidrag Renidrag is offline
Centurion
 
Join Date: Apr 2002
Location: Newfoundland
Posts: 123
Default

how can i have an event except different arguments?
__________________
- - Renidragd - -
Reply With Quote
  #8  
Old 06-23-2002, 09:37 AM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

When have you ever seen events that do?
(except control array vs single control)
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->