Using Multiplication In If And Then Statements?
Oct 5, 2009
I am very new VB .NET and just starting If statements. My problem is: Write an If statement that determines whether the variable CurrentBalance is greater then 1000.01. If it is, multiply the variable CurrentBalance by 1.005. Otherwise, multiply CurrentBalance by 1.007.So far I have
Sub Main()
Dim currentBalance As Boolean
System.Console.WriteLine("Enter Current Balance: " & currentBalance)
If CDbl(currentBalance) > 1000.01 Then
[code].....
I really don't even know if thats how I should be starting. Not sure what to put after the first Then on how to make it multiply currentBalance by 100.5.
View 5 Replies
ADVERTISEMENT
Oct 11, 2009
Can someone give me a site to a tutorial that will help me write a program that will generate a pattern using do while, if else statements,and do until statements. I have been using google but I can't find anything. I need to generate patterns a certain size 6 by 6 or similar such as something like a checkerboard but where the ^ symbols is there a suppose to be a blank space..
View 3 Replies
Mar 14, 2012
I am trying to figure out how to do this:
if (phrase = hello) then
"say hello"
if (phrase = how are you?) then
[CODE]...
So basically, I want it to work like a timeline. If I say hello, then it will respond and move onto the next if statement. Get it?
Here is the code I have now:
If phrase.Result.Text = "hello" Then
synth.Speak("Hello to you too")
If phrase.Result.Text.Contains("How are you") Then
[CODE]...
View 21 Replies
Nov 12, 2009
Dim result as single = 0
result = CType("8.01", Single) * 100 ' result=801.0 as expected
result = CType("8.02", Single) * 100 ' result=802.000061 --- not expected
Further to the above
result = 8.02 * 100 ' result = 802.0 as expected
View 4 Replies
Jan 29, 2010
This is part of a calculator program. I first part I sort by num and sign using a multitude of commandbuttons with no parenthesis.This program below is part of the second part. I have three more subroutines for /, +,- respectively.The + and - work correctly but * and / do not.I think it is in the line: numop(m) = g * h Is there something I am doing wrong wth the syntax in multiplication?
Public str, sign(100), numstr(100) As String
Public num1lock(100), m, n As Integer
Public ans, num(100), numop(100), g, h As Long
[code].....
View 4 Replies
Mar 11, 2008
I have an assignment to make a multiplication table using loops. The idea is to make this: If the user enters 3 this is the result he gets:
0 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
if the user enters 5, this is te result:
0 1 2 3 4 5
1 1 2 3 4 5
2 2 4 6 8 10
3 3 6 9 12 15
4 4 8 12 16 20
5 5 10 15 20 25
[Code]...
View 4 Replies
Dec 1, 2010
how to use the while loop in multiplication??
View 2 Replies
May 13, 2012
How do I multiply inside loop using this code ?
Dim a As Integer
Dim b As Integer
a = inputBox("Enter first Number:")
b = inputBox("Enter second Number:")
and I want the answer to be shown in a label.
View 2 Replies
Apr 16, 2012
I'm new to VB and programming in general and have not had too much trouble however i cannot figure this problem out and i've been working on it for a week. basically i have to create a program that calculates the mass of someone on another planet with the conversion numbers as constant, an input box for the user's mass, using select case format and output to a label including the name of planet ie "Your mass on &strPlantet is x" so what happens is my intWeight variable becomes zero and the lblResult is Zero. (i have not added the all the code for the label output) oh yeah i must also use a try/catch structure to prevent non numeric data from being input.[code]
View 20 Replies
Oct 29, 2010
i'm trying to make a multiplication and sum table only form 1 to 12. I get all kind of error I don't know what to do
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim numMulti, numSum, tCounter, multiSum As Integer
[Code].....
View 5 Replies
Feb 16, 2011
This is my assignment for tonight. If anyone can enlighten me as to why it doesn't work. I
know I haven't finished the timer, I trying to get results in the labels.[code...]
View 3 Replies
Nov 1, 2009
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim intCount = 1
[code].....
View 3 Replies
May 3, 2011
Here is the problem: In this question, you create an application that displays a multiplication table similar to the following figure, where x is a number entered by the user and y is the result of multiplying x by the numbers 1 through 9. Multiplication Table
[Code]....
View 2 Replies
Jan 30, 2010
Simple Calculator multiplication and division Trying to make a simple calculator. My program inputs numbers and arithmetic operations thru commandbuttons. The numbers, num(n-+1), are odd and the operations, op(n), are even. The code is based on the even op string. Every time a op occurs it is stored in numop(n) to be accessed later. I have all the other operations in sequential order: "*"," "/, "+" and "-". The other similar For-Next loop are the same just interchange the two * for /, +and -. The "+" and "-" work fine in this configuration.
My problem is the multiplication and division does not occur. The numbers and operations line up. The numop(m)=g*h should yield numop(m)=num(1)*num(3). Is there some sort of code to be inserted to accomplish these multiplication and division operations?
[Code]...
View 7 Replies
Aug 20, 2009
I am trying to multiply timespan by an integer....
Private Sub wtothrs0_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles wtothrs0.MouseClick
Dim temp As TimeSpan = TimeSpan.Parse(ttothrs0.Text) + TimeSpan.Parse(wetothrs0.Text)
wtothrs0.Text = temp.ToString
[code]....
i gives the error mes "Input string was not in a correct format."
View 14 Replies
Apr 28, 2012
I would like to multiply two single dimenssion arrays, having 5 elelments in each.
I prefer to use the SumProduct WorkSheet function.
I wrote this kind of line (below) but got a run time error #1004.
X = Application.WorksheetFunction.SumProduct(Array_1, Array_2)
I would like X to be the sum of the elelment multiplication of the two arrays/
View 1 Replies
Nov 15, 2011
How do I change / convert the result of the division or multiplication examples of the division = 200,1247 becomes 200,12 (2 decimal) I use this coding corrected my code is
[Code]...
View 3 Replies
May 17, 2012
i need to create a hash table using a multiplication method and i need to create an array of linked listso how i can to create array of linkedlist in vb or c# ?
View 1 Replies
Apr 12, 2009
I have to create a multiplication table and it has to contain a postest loop. For example:
[Code]...
View 1 Replies
Aug 20, 2010
How can I program a multiplication table that will input the x and y as columns and rows.
View 4 Replies
May 20, 2008
I want to open an Access database and I want to multiply 2 fields between each other. I am a newbie and till now I only have found the way to open the access database and create my Recordsets. So, for example, if I have table Mytbl that is a recordset with 4 fields (columns) and I would like to multiply column 3 with column 4 and put the results in a new Recordset, do I have to do it by multiplying each and every record
View 4 Replies
Jun 28, 2010
I have some combo boxes that basically set labels and scale multiplication factors for an XY grid. The combo boxes themselves work as they should. Two adjust scale levels of the XY grid (label and multiplication factors) the other changes the Y axis units (Imperial/Metric). The issue comes when I try to replot old data... I have the data in the array and have confirmed it is accurate...but...
When I apply the appropriate value to combobox.selectedindex and then call the Sub that actually makes the scale changes, the selected index reverts to -1. Small Example.... (note consider all variables as public and all routines in a single class - ignore spelling - this is a quick subset recreation not a copy).
Private Sub ReloadGraph()
combobox1.selectedindex = LengthScale(GraphNumber)
Call LengthLabels()
PlotUnits = Units(GraphNumber)
Call UnitsSet()
[Code] .....
OK - so I did add some code..... I did not actually run this code, but this is essentially a snapshot of what fails....when I step through line by line, the selectedindex changes to -1 as soon as I step to the second line of the second 2 Subs BEFORE it processes the second line (i.e. always after I step off Private Sub xxx() ). Again, both UnitSet and LengthLabels work OK separately when called, it is ONLY when I set the selectedindex from a variable (and again, it DOES set OK) and then call these routines that the selectedindex goes to -1. I have read a bunch of stuff relating to selectedindex and selectedvalue resetting IF one or the other is blank, but I have tried setting both in testing and this fails too!!
View 9 Replies
Mar 26, 2011
I have a command button to display a multiplication table in list box. the multiplication is from 1 to 5. my problem is, I have to use if else or looping in coding??
View 8 Replies
Sep 20, 2009
I have made an countdown app that is working in a normal way (added picture of it). Now when I select a number in the numeric box and click start, it starts to count down from that many minutes, but what I want is the number I put in the box *3. So if I put in 3 (points) the counter will count down 9 minutes. If it is possible I want a counter at the bottom every 3 minutes the value of the 000 at the bottom of the image multiply by 1 (+1 for every 3 mins timer1 runs).
View 8 Replies
Oct 2, 2009
Im using Visual Basic 2005."Devise a program to create a multiplication square for any size the user enters, up to a maximum of 10x10. The program should output something like this for a 4x4 square.
1234
2468
36912
481216
You will need to make use of the RichTextBox, along with concatenation to make the output format correctly within the box.When you have created the working program, document it properly by printing out and annotating the code to explain how it works."
View 4 Replies
Apr 27, 2010
My assignment was to Write a program to display a multiplication table for the integers from 1 to 4. So i did the code And got
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim n As Integer
[Code]....
The only problem with the code is that it displays only the integers 1 , 4, 9, and 16 when ran.
View 3 Replies
Mar 21, 2010
I need to code a basic multiplication table in VB. I need a popup input box to ask the user to enter a number, then a label to display the multiplication table for that number from 1 to 9.
[Code]...
View 5 Replies
Oct 31, 2011
I need to create a tiny calculator using the basic operators of Addition, Subtraction, Multiplication, and Division. My professor hasn't really covered much of this, so I'm not to sure how to create it.
View 6 Replies
Nov 26, 2010
I think for you my problem is very simple..I have done the same program in console mode without problem, now i try into windows form...
I generate by random 2 number A&B I multiply them and I will compare it with the result in my textbox3
if it the same as the computer has calculated il will show you congratulation, however i will say try again
I have a problem to calculate the sum, A&B are well generated but nothing in Calc Result
When Calc was working when I write nothing in the textbox3 and i click on Verify it show the msgbox congratulation.I'm looking just for this step, I've fixed the other issues And another things When It's right I would like to random another number for A&B after closing the msgbox, how can I processd ?
[Code]...
View 3 Replies
Jun 22, 2011
I'm using VB 2010 and need to multiply 2 user input numbers in forms, so basically: TextBox5 = TextBox2 * TextBox3 That obviously didn't work but it shows what I want it to do.
View 3 Replies