Hello all, it has been a while since I have posted here. Recently I purchased real basic and began programming in it today, the move from VB to RB should be easy I have been told and so far it has been easy then I encountered writing a function. The program I was asked to develop was fairly simple take in data, validate the data and then have it worked out using length*breadth*height/pupils.
My problem is basically End Function doe snot end the function instead I am told "Not found exception". I am sorry if this post seems a bit over the place.
Here is my coding:
I ahve place the coding which has been creating the difficulty in question in bold.Code:Dim height As Single Dim length As Single Dim breadth As Single Dim volume As Single Dim airspace As Single Dim studnets_allowed As Integer height = getValidNumber (2, 5) length = get ValidNumber (4, 10) breadth = getValidNumber (4, 10) airspace = GetValidResponse volume = height * length * breadth students_allowed = Int (volume / airspace) MsgBox ("Students allowed " & students_allowed) End Sub Function getValidNumber (Min, Max As Single) As Single Dim Num As Single Dim NumberOK As Boolean NumberOK = false Do Num = InputBox("Enter a number between " & Min & " and " & Max If Num >= Min and Num <= Mac Then NumberOK = True If Not NumberOK Then MsgBox ("That was not in the valid range") Loop until NumberOK getValidNumber = Num End Function Function GetValidResponse()As String Dim response As Single Dim responseOK As Single responseOK = False Do response = InputBox 9"Airspace per student . Either 2.1 or 3.2") If (response) = "2.1" Or (response) = "3.2" Then responseOK = True If Not responseOK Then MsgBox 9"That was not a valid amount of airspace ") Loop Until responseOK = True GetValidResponse = response End Function
All assistance offered would be great.
Thanks,
Colin




Reply With Quote