Jiskha Homework Help
SATURDAY
November 21, 2009
SCHOOL SUBJECTS
- Art
- Business
- Computers
- English
- Foreign Languages
- Health
- Home Economics
- Math
- Music
- Physical Education
- Science
- Social Studies
GRADE LEVELS
- Preschool
- Kindergarten
- Elementary School
- 1st Grade
- 2nd Grade
- 3rd Grade
- 4th Grade
- 5th Grade
- 6th Grade
- 7th Grade
- 8th Grade
- High School
- 9th Grade
- 10th Grade
- 11th Grade
- 12th Grade
- College
- Adult Education
Post a New Question | Current Questions | Chat With Live Tutors

Homework Help Forum: visual basic

Posted by Matrixschool on Tuesday, June 9, 2009 at 1:01pm.

(1) state the condition under which a FOR-TO-NEXT loop will not be executed.

(2) With the aid of illustrative example, describe how a subroutine is implemented in BASIC.

  • visual basic - MathMate, Tuesday, June 9, 2009 at 1:54pm

    You have not specified whether it is Visual Basic 6 or VB.net. In this case, the answers don't make a difference, but the versions will help to give a better context.

    1. The format of the for-next loop statement is:
    FOR i = start TO finish, [STEP s]
    ... statements to be executed
    NEXT

    On entering the loop, if the initial value of finish is greater than start, the statements inside the loop will not be executed at all.
    However, if s is specified and is negative, the loop content will not be executed if start is less than finish.

    Examples where the loop will not execute are:
    FOR i=10 TO -1.... next
    FOR k=1 TO 10 STEP -5... next


    2. Example:
    Here is an actual example from VB.net

    Sub keypressed(ByVal o As [Object], ByVal e As KeyPressEventArgs)
    If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Or Char.IsDigit(e.KeyChar) Or e.KeyChar = Microsoft.VisualBasic.ChrW(7) Then
    e.Handled = True
    End If
    End Sub 'keypressed

    You can modify it according to your requirements for describing how subroutines are implemented.

    For a VB6 tutorial:
    http://www.vbtutor.net/vbtutor.html

    For a VB.net tutorial:
    http://www.homeandlearn.co.uk/NET/vbNET.html

Answer this Question

First Name:
School Subject:
Answer:

SEARCH

COMMUNITY
FEATURES
- Live Tutors
- Net Riddle
- Reference
- Search