Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

coding basics

Posted on 1998-09-16
7
Medium Priority
?
169 Views
Last Modified: 2010-04-30
I have 3 questions. 1) What is the name for the statement placed in your code that allows one to monitor the progress of the code by printing the intermediate values? 2) What is the name for a variable that accepts true/false values? and finally 3) If I wanted to group additional option buttons beyond those directly on the form, what two objects may be used to accomplish this? Thank you.
0
Comment
Question by:gunga
  • 4
  • 2
7 Comments
 

Author Comment

by:gunga
ID: 1435281
Edited text of question
0
 

Author Comment

by:gunga
ID: 1435282
Adjusted points to 150
0
 
LVL 2

Accepted Solution

by:
wj7ster earned 600 total points
ID: 1435283
Answers to your Questions:

Q1.)  'Debug.Print myVariable' will print the value of the myVariable variable to the immediate window.

Q2.) You have to declare a variable as type 'Boolean'.  Declaration as follows:

Dim myVariable     As Boolean

This variable can then only be TRUE or FALSE.  Btw.  False = 0 and True = Not False, i.o.w. any value other than 0 (zero) is regarded as true.

Q3.) You can place 'groups' of option buttons on any container control.  Two other intrinsic controls that you can do this with is the Picturebox and Frame controls.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 12

Expert Comment

by:mark2150
ID: 1435284
1) debug.print
2) boolean
3) drop a "Frame" object and all controls inside it will be associated with a group
0
 

Author Comment

by:gunga
ID: 1435285
Would you care to answer this one? How many different constants are possible for the "mbtype" on the message box?
0
 
LVL 2

Expert Comment

by:wj7ster
ID: 1435286
The msgbox function in VB is very flexible.  Just a few basics on this:

It can be used to alert/inform the user or ask a question.

If you are using VB5 then it is easy to get the parameter info and list of properties/methods.

If you want to alert or inform the user you would normally just have an Ok button, the default and would use the MsgBox like this.

MsgBox "This is an alert!", vbExclamation, App.Title

This would bring up a msgbox with an exclamation icon, your application's titla as the caption and the words "This is an alert!" as the text.

You can also use the msgbox to ask a question:

First, we are interested in the user's response, so we create a variable to hold the reponse:

Dim lResponse     As VbMsgBoxResult

   lResponse = MsgBox("Are you sure you want to format your hard drive?", vbQuestion + vbYesNo, App.Title)

' This will prompt the user with a question (a questionmark icon will be displayed on the msgbox) and there will be two buttons, a 'Yes' button and a 'No' button.

' Now we can evaluate the user's answer:
  If lResponse = vbYes then
     ' We format his hard drive
  Else  ' The user selected No
     ' we do nothing
  End If

The constants used to manipulate the msgbox are as follows:

 - modal
vbApplicationModal - Will bring the msgbox to the top of your program.  No other forms will obscure it.
vbSystemModal - will bring the msgbox to the top of all other programs that is open on your desktop.

 - icons
vbCritical - Displays a 'critical' icon on the msgbox
vbExclamation - displays an exclamation icon
vbInformation - displays an information icon
vbQuestion - Shows a question icon

 - defaults
vbDefaultButton1 - makes the first button the default, i.o.w. if the user presses enter instead of clicking on one of the buttons, the first button will be selected.
vbDefaultButton2 - same as above for second button
vbDefaultButton3 - same as above for third button
vbDefaultButton4 - same as above for fourth button

 - help:
vbMsgBoxHelpButton - displays a 'Help' button on the msgbox.  you have to set the 'helpfile' and 'contextid' parameters as well to use this.

 - buttons:
vbOkCancel - displays 'Ok' and 'Cancel' buttons
vbOkOnly - displays only an 'Ok' button (this is the default)
vbRetryCancel - displays 'Retry' and 'Cancel' buttons
vbAbortRetryIgnore - displays the buttons 'Abort' 'Retry 'Ignore'
vbYesNo - displays 'Yes' and 'No' buttons
vbYesNoCancel - displays 'Yes', 'No' and 'Cancel' buttons

You can combine the style by adding (+) the values together from each of the categories listed above.  Not, you cannot add two constant from the same category.

eg to get a msgbox with 'Abort', 'Retry' and 'Ignore' buttons and an exclamation icon that is modal (on top) of all the other forms in your program, you can add

vbAbortRetryIgnore + vbExclamation + vbApplicationModal


Return value:
The possible results that can be returned will be: (I listed the numeric values for each in brackets)

vbAbort (3) - the user selected the 'Abort' button
vbCancel (2) - the user selected the 'Cancel' button
vbIgnore (5) - the user selected the 'Ignore' button
vbNo (7)- the user selected the 'No' button
vbOk (1) - the user selected the 'Ok' button
vbRetry (4) - the user selected the 'Retry' button
vbYes (6) - the user selected the 'Yes' button


For more information, see the on-line help on 'MsgBox'

I hope this helped


Kind regards


Willem Sevenster

0
 

Author Comment

by:gunga
ID: 1435287
Thank you so much for the help/info. I learned quite a lot today.
Much Appreciated.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question