Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Option buttons

Posted on 1998-08-18
3
Medium Priority
?
155 Views
Last Modified: 2010-04-30
every time i use a option button in a calculation program i get -1 in the answer box
0
Comment
Question by:kelly1
[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
3 Comments
 
LVL 1

Expert Comment

by:Sekans
ID: 1429593
What is the code you're using?  -1 is the same as True (or more accurately Not False)  Please ellaborate on your question.

Regards,
Sekans
0
 
LVL 6

Accepted Solution

by:
anthonyc earned 100 total points
ID: 1429594
Kelly,

You are using the option button value, which is true/false value.  You want to use the index of the option button that is marked as true.  To do this, make your option button group a control array, and set the indexes to the value you want.  To get the integer value representation of the option button, do this

public function OptionButtonValue(optgrp as object, optional nDefault as integer = -1) as integer
  dim opt as optionbutton

  optionbuttonvalue = nDefault
  for each opt in optgrp
    if opt.value then
      optionbuttonvalue = opt.index
      exit function
    end if
  next opt
end function

0
 

Expert Comment

by:dkaratzios
ID: 1429595
Hi kelly1,

Have you tried putting your calculations in variables ? This way, you only use your option buttons to indicate which variable to want in your calculations?

ex:
dim opt_var as long
opt_var = any number for calculation

if optionbutton is true then
opt_var * whatever
end if

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
Suggested Courses

610 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