Visual Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 17974
Number of posts: 55343

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
interface question Posted by kittywaltz on 25 Feb 2006 at 9:09 AM
I am to write a program to compute services rendered,the program is to request a person's occupation,the amount of the bill,and the percentage of the tip as input.this information is to pass to a sub program to display the person and the tip.
My question is, What tools go into the interface? I have lables for the person's occupation, the amount of the bill,and the percent of the tip, but do I use text boxes or picture boxes for the output?or both? what would go where?
please email catdancing@sbcglobal.net

Report
Re: interface question Posted by DrMarten on 25 Feb 2006 at 12:10 PM

Why not start using the in-built help a bit more?
It gives an EXAMPLE if you click the word EXAMPLE after you do a search.

E.G. For sub procedure>>

Sub Statement

See Also Example

Declares the name, arguments, and code that form the body of a Sub procedure.

Syntax

[Private | Public] [Static] Sub name [(arglist)]
[statements]
[Exit Sub]
[statements]
End Sub

The Sub statement syntax has these parts:

Part Description

Public Indicates that the Sub procedure is accessible to all other procedures in all modules.
Private Indicates that the Sub procedure is accessible only to other procedures in the module where it is declared.
Static Indicates that the Sub procedure's local variables are preserved between calls. The Static attribute doesn't affect variables that are declared outside the Sub, even if they are used in the procedure.
name Name of the Sub; follows standard variable naming conventions.
arglist List of variables representing arguments that are passed to the Sub procedure when it is called. Multiple variables are separated by commas.
statements Any group of statements to be executed within the body of the Sub procedure.

The arglist argument has the following syntax and parts:
[Optional][ByVal | ByRef][ParamArray] varname[( )] [As type]

Part Description

Optional Indicates that an argument is not required. If used, all subsequent arguments in arglist must also be optional and declared using the Optional keyword. All Optional arguments must be Variant. Optional can't be used for any argument if ParamArray is used.
ByVal Indicates that the argument is passed by value.
ByRef Indicates that the argument is passed by reference.
ParamArray Used only as the last argument in arglist to indicate that the final argument is an Optional array of Variant elements. The ParamArray keyword allows you to provide an arbitrary number of arguments. It may not be used with ByVal, ByRef, or Optional.

varname Name of the variable representing the argument; follows standard variable naming conventions.
type Data type of the argument passed to the procedure; may be Byte, Boolean, Integer, Long, Currency, Single, Double, Date, String (variable length only), Object, Variant, a user-defined type, or an object type.

Remarks

If not explicitly specified using either Public or Private, Sub procedures are public by default. If Static is not used, the value of local variables is not preserved between calls.
All executable code must be in procedures. You can't define a Sub procedure inside another Sub, Function, or Property procedure.
The Exit Sub keywords cause an immediate exit from a Sub procedure. Program execution continues with the statement following the statement that called the Sub procedure. Any number of Exit Sub statements can appear anywhere in a Sub procedure.
Like a Function procedure, a Sub procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments. However, unlike a Function procedure, which returns a value, a Sub procedure can't be used in an expression.
You call a Sub procedure using the procedure name followed by the argument list. See the Call statement for specific information on how to call Sub procedures.

Caution Sub procedures can be recursive; that is, they can call themselves to perform a given task. However, recursion can lead to stack overflow. The Static keyword usually is not used with recursive Sub procedures.

Variables used in Sub procedures fall into two categories: those that are explicitly declared within the procedure and those that are not. Variables that are explicitly declared in a procedure (using Dim or the equivalent) are always local to the procedure. Variables that are used but not explicitly declared in a procedure are also local unless they are explicitly declared at some higher level outside the procedure.

Caution A procedure can use a variable that is not explicitly declared in the procedure, but a naming conflict can occur if anything you have defined at the module level has the same name. If your procedure refers to an undeclared variable that has the same name as another procedure, constant or variable, it is assumed that your procedure is referring to that module-level name. Explicitly declare variables to avoid this kind of conflict. You can use an Option Explicit statement to force explicit declaration of variables.

Note You can't use GoSub, GoTo, or Return to enter or exit a Sub procedure.

Regards,

Dr M


Report
because Posted by kittywaltz on 25 Feb 2006 at 12:29 PM
: The visual basic program I have doesn't cantain any help at all.
: Why not start using the in-built help a bit more?
: It gives an EXAMPLE if you click the word EXAMPLE after you do a search.
:
: E.G. For sub procedure>>
:
: Sub Statement
:
: See Also Example
:
: Declares the name, arguments, and code that form the body of a Sub procedure.
:
: Syntax
:
: [Private | Public] [Static] Sub name [(arglist)]
: [statements]
: [Exit Sub]
: [statements]
: End Sub
:
: The Sub statement syntax has these parts:
:
: Part Description
:
: Public Indicates that the Sub procedure is accessible to all other procedures in all modules.
: Private Indicates that the Sub procedure is accessible only to other procedures in the module where it is declared.
: Static Indicates that the Sub procedure's local variables are preserved between calls. The Static attribute doesn't affect variables that are declared outside the Sub, even if they are used in the procedure.
: name Name of the Sub; follows standard variable naming conventions.
: arglist List of variables representing arguments that are passed to the Sub procedure when it is called. Multiple variables are separated by commas.
: statements Any group of statements to be executed within the body of the Sub procedure.
:
: The arglist argument has the following syntax and parts:
: [Optional][ByVal | ByRef][ParamArray] varname[( )] [As type]
:
: Part Description
:
: Optional Indicates that an argument is not required. If used, all subsequent arguments in arglist must also be optional and declared using the Optional keyword. All Optional arguments must be Variant. Optional can't be used for any argument if ParamArray is used.
: ByVal Indicates that the argument is passed by value.
: ByRef Indicates that the argument is passed by reference.
: ParamArray Used only as the last argument in arglist to indicate that the final argument is an Optional array of Variant elements. The ParamArray keyword allows you to provide an arbitrary number of arguments. It may not be used with ByVal, ByRef, or Optional.
:
: varname Name of the variable representing the argument; follows standard variable naming conventions.
: type Data type of the argument passed to the procedure; may be Byte, Boolean, Integer, Long, Currency, Single, Double, Date, String (variable length only), Object, Variant, a user-defined type, or an object type.
:
: Remarks
:
: If not explicitly specified using either Public or Private, Sub procedures are public by default. If Static is not used, the value of local variables is not preserved between calls.
: All executable code must be in procedures. You can't define a Sub procedure inside another Sub, Function, or Property procedure.
: The Exit Sub keywords cause an immediate exit from a Sub procedure. Program execution continues with the statement following the statement that called the Sub procedure. Any number of Exit Sub statements can appear anywhere in a Sub procedure.
: Like a Function procedure, a Sub procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments. However, unlike a Function procedure, which returns a value, a Sub procedure can't be used in an expression.
: You call a Sub procedure using the procedure name followed by the argument list. See the Call statement for specific information on how to call Sub procedures.
:
: Caution Sub procedures can be recursive; that is, they can call themselves to perform a given task. However, recursion can lead to stack overflow. The Static keyword usually is not used with recursive Sub procedures.
:
: Variables used in Sub procedures fall into two categories: those that are explicitly declared within the procedure and those that are not. Variables that are explicitly declared in a procedure (using Dim or the equivalent) are always local to the procedure. Variables that are used but not explicitly declared in a procedure are also local unless they are explicitly declared at some higher level outside the procedure.
:
: Caution A procedure can use a variable that is not explicitly declared in the procedure, but a naming conflict can occur if anything you have defined at the module level has the same name. If your procedure refers to an undeclared variable that has the same name as another procedure, constant or variable, it is assumed that your procedure is referring to that module-level name. Explicitly declare variables to avoid this kind of conflict. You can use an Option Explicit statement to force explicit declaration of variables.
:
: Note You can't use GoSub, GoTo, or Return to enter or exit a Sub procedure.
:
: Regards,
:
: Dr M
:
:
:

Report
Re: because Posted by DrMarten on 25 Feb 2006 at 12:50 PM
This message was edited by DrMarten at 2006-2-25 12:54:21


: : The visual basic program I have doesn't cantain any help at all.

Try asking your teacher to show you where the help files are, failing that ask Him/ Her for the help files.

It may save you asking lots of questions in this forum.

I dont mean to sound nasty here but the simpler stuff should be covered by the stuff in>>

http://www.codepedia.com/1/BeginnersGuideToVB

or get a book out of your local library on VB6 ( or the version you are using ), after all libraries are free.



Regards,

Dr M.

Report
visual basic desperation Posted by kittywaltz on 25 Feb 2006 at 1:06 PM
I have been asking since the start of this class in Janurary. All I've been told is that if i don't undrerstand the class to drop it. Unfortunitely I can't afford to do that or I would. I just need to get through it.Can someone help?


: This message was edited by DrMarten at 2006-2-25 12:54:21

:
: : : The visual basic program I have doesn't cantain any help at all.
:
: Try asking your teacher to show you where the help files are, failing that ask Him/ Her for the help files.
:
: It may save you asking lots of questions in this forum.
:
: I dont mean to sound nasty here but the simpler stuff should be covered by the stuff in>>
:
: http://www.codepedia.com/1/BeginnersGuideToVB
:
: or get a book out of your local library on VB6 ( or the version you are using ), after all libraries are free.
:
:
:
: Regards,
:
: Dr M.
:
:

Report
Re: interface question Posted by lionb on 27 Feb 2006 at 5:58 AM
This message was edited by lionb at 2006-2-27 6:2:18

: I am to write a program to compute services rendered,the program is to request a person's occupation,the amount of the bill,and the percentage of the tip as input.this information is to pass to a sub program to display the person and the tip.
: My question is, What tools go into the interface? I have lables for the person's occupation, the amount of the bill,and the percent of the tip, but do I use text boxes or picture boxes for the output?or both? what would go where?
: please email catdancing@sbcglobal.net
:
:
You can use ListView control, HFlexGridControl or FlexGridControl, if you are using VB 6. In case you are using VB.NET use ListView or DataGrid. There are a bunch of code example for those controls on Google.

Here it is one
http://www.codeguru.com/cpp/controls/listview/

and another one

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbobjlistview.asp
Report
Re: interface question Posted by kittywaltz on 28 Feb 2006 at 7:07 AM
: This message was edited by lionb at 2006-2-27 6:2:18

: : I am to write a program to compute services rendered,the program is to request a person's occupation,the amount of the bill,and the percentage of the tip as input.this information is to pass to a sub program to display the person and the tip.
: : My question is, What tools go into the interface? I have lables for the person's occupation, the amount of the bill,and the percent of the tip, but do I use text boxes or picture boxes for the output?or both? what would go where?
: : please email catdancing@sbcglobal.net
: :
: :
: You can use ListView control, HFlexGridControl or FlexGridControl, if you are using VB 6. In case you are using VB.NET use ListView or DataGrid. There are a bunch of code example for those controls on Google.
:
: Here it is one
: http://www.codeguru.com/cpp/controls/listview/
:
: and another one
:
: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbobjlistview.asp


Thank You
:




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.