home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,954 of 10,840   
   D & J G to Raoul Watson   
   Re: Unexpected Error!!   
   11 Mar 06 23:18:11   
   
   From: donandjane@optusnet.com.au   
      
   "Raoul Watson"  wrote in message   
   news:%IzQf.3$Vb.2@trndny01...   
   >   
   > "D & J G"  wrote in message   
   > news:44128b0c$0$14239$afc38c87@news.optusnet.com.au...   
   >>   
   >   
   >> When running, as soon as the code gets to   
   >> myDebug   
   >> I get the message   
   >>   
   >> Compile Error:   
   >> "Argument not optional"   
   >>   
   >   
   > the routine expect a string to be passed. If you omit it, you will get an   
   > error.   
   > If you use a variable, make sure the variable is declared as a string, e.g   
   >   
   > Dim mystr as String   
   > ...   
   > mystr = "Getting user network ID."   
   > call myDebug(mystr)   
   >   
   > if not, you'll get a byref argument type mismatch. test out the routine by   
   > itself   
   > Just create a form with a button:   
   >   
   > Private Sub Command1_Click()   
   > Dim mystr As String   
   > mystr = "Cmd 1 Pressed"   
   >  Call myDebug(mystr)   
   > End Sub   
   >   
   > Sub myDebug(mystr$)   
   > Dim f$   
   > f$ = App.Path & "\debug.txt"   
   > Open f$ For Append As #1   
   >  Print #1, mystr$   
   > Close   
   > End Sub   
   >   
   Thank you so much, Raoul.  How dumb I feel!  All was OK except that I hadn't   
   declared the variable (Duh).   
      
   All is well now.  Just have to test it in my program.   
      
   Don   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca