Get The Maximum Value Of Two Numbers?
Jul 24, 2011I'm trying to get the maximum value of two numbers.I want my variable z to be equal to the maximum between x and y
View 5 RepliesI'm trying to get the maximum value of two numbers.I want my variable z to be equal to the maximum between x and y
View 5 RepliesIm trying to write a program that will do:
1.The average of the four numbers. This answer will be placed into a text box reserved for that value. This text box cannot be changed by the user.
2.The maximum and minimum values. These will be denoted by changing the color of the largest number green and the smallest number red.
3.The range of the numbers. The range is defined as the difference between the largest and smallest numbers. The range will be placed into its own text box, labeled as such. This text box cannot be changed by the user."
Im using visual studio 2008 and it has to be written in VB
i am creating a maths program that works out five number summarys of a range of data. i am having trouble working out the smallest number in a group of numbers. i have used a bunch of if then statements to work out the maximum and i figured that by exchanging a few variables and swapping greater than signs for less than i could use the same code to work out the minimum, but all i get is zero, no matter what i input into my textboxes. below is the code i have used to work out the maximum number
If CheckBox1.Checked = True And CheckBox6.Checked = True Then
max = 0
min = 1000
[Code]......
how can i code a simple program to generate the maximum number i enter/type within 3 or more numbers using math.max. for example, if i enter 25, 60, 45 how can i use math.max to calculate the largest value out of the 3 numbers?
View 4 RepliesCalculate maximum or minimum of "x" numbers
View 2 RepliesI have six textboxes, and upon button press it randomly generates six numbers, one in eact text box e.g. [43] [85] [93] [1] [0] [17]..i create another six textboxes and at the same time allocate these numbers in ascending/descending numbers.I am not looking for any codes whatsoever, as i love the challenge of VB.Net.
View 2 RepliesSo how would I use .next (random numbers) to randomly select something from a list of numbers but it can't repeat the number?I could do:
dim num as integer
dim r as new random
num = r.next(1,5)
if num = 1 then
elseif num = 2 then
etc.
That wouldn't work because it would repeat.If I donwload someone's game can I disect it in VS? :0 I tried going to open project, then I went to the folder and clicked open. It brought me inside of the folder so I tried to open the game but there is no form1 there. It says the games name then .exe in the explorer-like thing in the top right?Also, how would I have a value or something in a label and access it from a button.
Example:This is in a label.
Dim number as Integer
number = 0
Then in the button do
Label.number = 0
How would I do something like that? I want to use that a lot as I did in a different language.
I have a program that allows a user to input numbers from an inputbox and it displays the Total numbers entered, the sum of the numbers entered, and the average of the numbers entered. What I can not seem to find it how to have it display the largest number entered. The code I have so far is,
[Code]...
how can i add two excel sheets with numbers and the equal (similar)numbers to save once
View 1 RepliesI am making a program, where the user enters 6 numbers in 6 different text boxes, and it displays the larger of those 6 numbers. But I also want to make it where if the user enters a string value (like S for instance) in the text boxes, it gives an message and says "please enter the numbers again" and the user gets to enter the 6 numbers again. But when I do try to do that, it gives an error message saying conversion from "w/e the user entered" to Double is not valid. If the user just enters the numbers, it works fine. However, I am trying to make it if the user does enter non numeric value, it gives a message window and the user can reenter the numbers again.
Here is my code Example
CODE:
This is where I am trying to use IsNumeric to show a message if a user does not enter a string so the user can renter the numbers again, but when the user does enter a string value (say in textbox 1) it gives me an error message saying conversion from "S" to 'double' is not valid.
CODE:
Then right here this is where I have my series of ifs statements, this part works fine, it displays the largest numbers of the 6 textboxes every time. Error free.
CODE:
And do this with variable number 2, 3, 4, 5.
I know there are easier ways to do these with arrays and stuff. But I am not there yet. I am still learning about ifs and stuff.
I have just about completed a .NET project to write a program to randomly select numbers for a Bingo caller. Over the last month or so Ive learned a lot about .NET but heres something that I consider to be odd and maybe one of you guys can offer an opinion.
One of the features of calling Bingo in a small local club is that callers often use little sayings to accompany certain numbers, I expect youve all heard of (say) All the sixes, clickety click for 66 or 5 and 9 the Brighton line for 59 etc. My little program gives an option to incorporate these with a prompt for the caller that can be edited outside of the program. One of these conventional sayings is used when a number is reversed 12 followed by 21 or 45 followed by 54 for example, when the caller might call (say) 1 and 2, one dozen, number 12 And the other way round 2 and 1, twenty one.
So, I programmed in a bit of code to detect this and to over-ride whatever might otherwise have been the quote with And the other way round and set about testing it. Ive been through literally dozens of full 90 calls watching for the occurrence of a reversed number, spent a few hours doing it, and not once has it occurred which is to say the least, unusual.
So, Im wondering about the Rand Function, could it be that it isnt possible for a reversed number to be selected? Just so you know, I randomly pre-select the order of all 90 numbers, I fill each of the 90 elements of an array with a random number first checking that the number selected hasnt already been stored, if it has, I just get the next random number (and check that too of course), but I cant see how that could prevent reversed numbers being selected, especially in light of the fact that frequently it's not the 'next' number that's used.
I'm attempting to invoke with parameters:[code]Value of '415' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.Parameter name: Value..What does this mean? Is there a way around it?
View 2 Replieshow can i get the maximum number in visual basic
View 4 RepliesI created a new control. When the user changes the font, I don't want the user to change the font past font size 14. If the user changes the font past 14, the font should reset to 14.
[code]...
am writing an system application for a company that must generate inquiry id and order id automatically. Whenever a customer makes a new inquiry or new order by clicking the add button, an automatic number should be displayed in the text box and when it's saved, it should be saved in the database access.
View 9 RepliesHow do you sort strings with numbers when you want numbers sorted based on their dimension?
View 19 RepliesSub five()
Dim i As Integer
For i = 1 To 14[code].....
I want the numbers that I was comparing similar numbers. I get equal numbers and ELSE giving all series.I like numbers 2 4 6 8 9 10
I would like to know how I can have an enumeration that has multiple values and can be passed to a function.
Example:
Public
Enum
ActionEnum
NoAction = 0
[code]....
I am working on an assignment that will display the forst 10 fibonacci numbers in sequence. However when my results are displayed, the numbers are all stacked on top of each other like this: 011235813213455. I have tried to play with it but i can't seem to get my numbeers to space out or even maybe have a comma "," betweeen each number.[code]
View 2 RepliesThe program must generate 6 unique random numbers but when I click display numbers sometimes it gives me 6 unique numbers and sometimes I get duplicate numbers. I will add the code I have so far.
Public Class frmMain
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
[CODE]...
i have one more issues, and hope is the last for now. How can I limit a textboxe's input to only numerical with certain range of values (eg -10 to 10) and with that happening while I type in the values?
View 9 RepliesI'm trying to make a program that will calculate the sum of consecutive numbers between two given numbers. [code]
View 13 RepliesI'm using VB08. I've populated a listbox with numbers and I want to add all those numbers together and display the result in a Label. I've heard about using parse but I don't understand exactly how it works.
This is the code that I have that i think should work.
Dim lblTotal As Decimal
Dim sum As Double
For Each decAdded As Decimal In Me.lstRunningTotal.Items
sum += Double.Parse(decAdded)
Next
lblTotal = FormatCurrency(sum)
When I run it, nothing happens. My "For Each" statement I'm not sure if it's doing what I think it's doing. I can't believe I spent 6 hours banging my head against the wall but I finally got it figured out.
This is my revised code:
Dim sum As Decimal
For Each decAdded As Decimal In Me.lstRunningTotal.Items
sum += Decimal.Parse(decAdded)
Next
lbl_Total.Text = sum
Just some suttle changes made the difference
I am currently making my own custom controls, I want the user to be able to change the control's size, but only the width, the height needs to stay constant.
View 3 RepliesHow do you set the maximum number of rows allowed in a given DataGridView control? I'm using an unbound (meaning unbound to any data table) DGV to create a spreadsheet like entry. This is in order to allow the user to enter an array (80 elements). I can stretch the DGV into 80 columns and limit myself to 1 row or I can do 1 column 80 times. Either way, I need to limit the user to a finite number of rows...
View 5 RepliesSqlServer Table1 has data as follows
Sno-------date
1------01/01/2010
8------01/01/2010
1------02/01/2010
[Code]....
1) I want to display the SMALLEST Date into textbox1 which is 01/01/2010
2) I want to display the BIGGEST Date into textbox2 which is 18/01/2010
3) I want to display the BIGGEST SNO against date 18/01/2010 into textbox3 which is 9
4) I want to display total records against date 18/01/2010 into textbox4 which is 3
I have been very stumped by this one. I have a fairly large (~1500 x ~1000) DataTable of positive and negative integers only that I acquired from a .csv file. For my program, I need to find the maximum value of the entire table, not just in a single row or column. Optimally, the code would be short and sweet, but that's not always the case ;).
The name of my DataTable is BeamMap and I am trying to return a value of MaxValue (already declared as an integer). I can post the code I have for creating the DataTable upon request.
Extra Credit: (not really)
Is there a way to quickly find the location (ie., row,column) of said maximum value? So far, all of the examples I've seen check cell by cell for a predetermined value, which is rather inefficient for the number of data points that I have.
My form length is currently 1040 which when run displays as 870 and I use the vertical scroll bar to access the the boxes not displayed. I need more however, let's just say 1140 in length, but when I type that number into the 'size height' it only goes to 1044. Is there a way for my form to be the length that I need?
View 2 Repliesim using a trackbar (First time of using one)i want the trackbar to go up in 1`s to a maximum of 400 at the moment it goes up in 10`s iv looked at the properties of this and i cant seem to figure how to change it from 10 to 1, I looked at the maximum and changed that from 10 to 1 but it just counts the hole trackbar as one which is doing the complete opposite to what i want?
View 2 RepliesI need to setting the maximum size on a picture box. I thought the syntax for setting size was picturebox.MaximumSize = (Width,Height) but doesnt seem to work. Did syntax change from VB6?
View 2 Replies