Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Problem passing value from Module


Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2006, 04:37 AM
ruthers ruthers is offline
Freshman
 
Join Date: Oct 2005
Posts: 27
Default Problem passing value from Module


I have created a form which runs through files and checks whether they have certain information in them (a formchecker)

The form code is now growing out of control and I want to break it down and put them in functions in modules.

my code was working before I tried to do this but I cannot work out how to get the boolean response back into my form code.

Public Function isOptionExplicit(strLn As String) As Boolean
On Error GoTo ErrorHandler

If InStr(1, LCase$(strLn), "option explicit") > 0 Then
If Mid$(strLn, 1, 1) <> "'" Then 'check line isn't commented
If StrComp(Mid$(Replace(LCase$(strLn), Space(1), ""), 1, 14), "optionexplicit") = 0 Then
isOptionExplicit = True
Else
End If
End If


Exit Function

ErrorHandler:
MsgBox "CheckOptionExplicit", Err.Number, Err.Description
End Function

'''''
Trying to get the code back into the form code

if check1(checkenum.checkoptionexplicit).value = vbchecked then
if IsOptionExplicit(strLn) = true then 'This is where I want the boolean True or false to be brought back in
end if

But it is saying (strln) variable not defined....
What am I doing wrong
Reply With Quote
  #2  
Old 01-19-2006, 04:52 AM
MilanJ MilanJ is offline
Junior Contributor
 
Join Date: Sep 2005
Posts: 370
Default

Quote:
Originally Posted by ruthers
...
Trying to get the code back into the form code

if check1(checkenum.checkoptionexplicit).value = vbchecked then
if IsOptionExplicit(strLn) = true then 'This is where I want the boolean True or false to be brought back in
end if

But it is saying (strln) variable not defined....
What am I doing wrong
Did you declared variable strLn in calling procedure?
Reply With Quote
  #3  
Old 01-19-2006, 05:37 AM
ruthers ruthers is offline
Freshman
 
Join Date: Oct 2005
Posts: 27
Default

No, so I have changed it to (Ln) which is the same as the calling procedure.

If Check1(CheckEnum.checkoptionexplicit).Value = vbChecked Then
isfound(CheckEnum.checkoptionexplicit) = isOptionExplicit(Ln)
If isfound(CheckEnum.checkoptionexplicit) = True Then
End If

End If

''
If this receives a True how can I stop the rest of the coding.
Reply With Quote
  #4  
Old 01-19-2006, 05:43 AM
MilanJ MilanJ is offline
Junior Contributor
 
Join Date: Sep 2005
Posts: 370
Default

If it receives True, then insert some commands in this IF statement:

If isfound(CheckEnum.checkoptionexplicit) = True Then

... what you want to do - I don't know. You can, for example, exit procedure (Exit Sub )

End If
Reply With Quote
  #5  
Old 01-19-2006, 06:19 AM
ruthers ruthers is offline
Freshman
 
Join Date: Oct 2005
Posts: 27
Default

Thanks , I knew it would be something simple.
Reply With Quote
  #6  
Old 01-19-2006, 08:00 AM
ruthers ruthers is offline
Freshman
 
Join Date: Oct 2005
Posts: 27
Default

I am still having trouble with this. I have put

If Check1(CheckEnum.checkoptionexplicit).Value = vbChecked Then
isfound(CheckEnum.checkoptionexplicit) = isOptionExplicit(ln)
If isfound(CheckEnum.checkoptionexplicit) = True Then
Exit Sub

End If
End If

But I am not wanting it to exit the sub, just stop this one check and go onto the next.

any ideas?
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
 
 
-->