Results 1 to 5 of 5

Thread: writing a procedure?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2007
    Location
    FAT32
    Posts
    61

    writing a procedure?

    how do you java people write a procedure? or something similiar

    Code:
    private sub CboLoad();
    {
    cboVehicleList.get_Items().Add("Car");
    cboVehicleList.get_Items().Add("Boat");
    cboVehicleList.get_Items().Add("Bus");
    }
    
    private void cboVehicleList_SelectedIndexChanged(Object sender, System.EventArgs e)
    {
    cboLoad();
    }
    this is based on some java knowledge and VB, how can I do this to add these items into a Combobox. any contributions will be appreciated

    thanks

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: writing a procedure?

    Don't do that next time. It just confuses people.
    Java like most programming languages has the return type "void" for functions and methods that doesn't return a value.
    Code:
    public void methodName (int param1, String param2){
      //Code here
    }
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    Lively Member
    Join Date
    Jun 2006
    Posts
    82

    Re: writing a procedure?

    the basic java syntax for a method(a procedure in VB) is as follows.

    public void theMethodName(theParameterList){
    // instance field
    // methods..............
    }

    infact the key word "void" can be appropriately changed according to the return type of the method.

    So, model your program according to the above syntax with the same logic.

  4. #4
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: writing a procedure?

    Yep,
    The syntax is:
    Code:
    AccessModifier ReturnType MethodName (Params){
    Body of the method
    }
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  5. #5
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: writing a procedure?

    More deeply I believe method should like as follows in Java,

    1. In other methods are called as functions, subroutines or procedures.
    2. Method take zero or more parameters and may or may not gives a result.
    3. Java method never return more than one result.
    4. There are no stand-alone methods, not even main method.
    5. Simply a method is part of a class in Java.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width