Solved

coding basics

Posted on 1998-09-16
7
156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 150 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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
Course of the Month5 days, 5 hours left to enroll

636 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