Solved

coding basics

Posted on 1998-09-16
7
150 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 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now