|
-
Jun 15th, 2007, 03:52 AM
#1
Thread Starter
Member
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
-
Jun 15th, 2007, 04:22 AM
#2
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
-
Jun 15th, 2007, 07:16 AM
#3
Lively Member
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.
-
Jun 15th, 2007, 08:06 AM
#4
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
-
Jun 18th, 2007, 03:26 AM
#5
PowerPoster
Re: writing a procedure?
More deeply I believe method should like as follows in Java,
- In other methods are called as functions, subroutines or procedures.
- Method take zero or more parameters and may or may not gives a result.
- Java method never return more than one result.
- There are no stand-alone methods, not even main method.
- 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|