473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

help me in the division by zero

How can i put a message "Math Error" in the displaytext of my calculator if a division by zero is applied???


For those who knows this one,
Can you help me?? please...
May 16 '09 #1
3 1984
prabirchoudhury
162 100+
ok.. you may use this


Expand|Select|Wrap|Line Numbers
  1.  
  2. Try
  3.   ' your code that caused problem
  4.  Catch eD As System.DivideByZeroException
  5.     MessageBox.Show("Divide by zero has occurred")
  6.  End Try
  7.  
  8.  
May 17 '09 #2
dim num1 as integer
dim num2 as integer
dim answer as integer
dim operation as string
Option Explicit


if operation="/" Then
answer = num1/num2
End If

how can i make a msgbox denoting that a division by zero is occured, instead of error,,

thx,
May 17 '09 #3
QVeen72
1,445 Expert 1GB
Hi,

Try This :

Expand|Select|Wrap|Line Numbers
  1. if operation="/" Then
  2. If num2 = 0 then
  3.   MsgBox "DIVISION BY ZERO....."
  4. Else
  5.   answer = num1/num2
  6. End If
  7. End If
  8.  
Regards
Veena
May 18 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Matthew Paterson | last post by:
Can anyone tell me why in the code below the sql execute that uses $sql99 does not work while the one with $sql2 works. $sql99 is exactly the same as $sql2 when printed out. I get an error...
1
by: florian.boldt | last post by:
Hi Folks, one of our developers uses a statement with a where clause which usually does not match to any rows. In case of one or more rows found she wrote a an expression in the select clause...
9
by: Marcin | last post by:
How I can make division of two numbers placed in arrays, example: short int a = {2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2}; short int b =...
16
by: Greg Donald | last post by:
Converting some MySQL code to work with Postgres here. I have this query: SELECT tasks.task_id, (tasks.task_duration * tasks.task_duration_type / count(user_tasks.task_id)) as...
3
by: aking | last post by:
Dear Python people, im a newbie to python and here...so hello! Im trying to iterate through values in a dictionary so i can find the closest value and then extract the key for that...
2
by: Pakna | last post by:
Why do I have a zero result on this query for all non-zero rows? Do I have to declare specifically the precision of ratio division? How do I do that? And is there a way to make DB2 'ignore'...
94
by: krypto.wizard | last post by:
Last month I appeared for an interview with EA sports and they asked me this question. How would you divide a number by 7 without using division operator ? I did by doing a subtraction and...
9
by: Joe Cool | last post by:
Hello, I am using VS2005. I am trying to convert a VB.NET app to C#.NET. The VB app uses a progress meter to indiate how far a file has been read. I use the following assignment statement in VB: ...
7
by: jackie | last post by:
I know in c that 3/2 gets 1 and 3%2 is also 1,and i think this is guaranteed by C99(is that true?),but on the other hand,-3/2 may be -1 or -2,and -3%2 may be -1 and 1 respectively,it is implement-...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.