Getting largest and smallest number from an array and placing in 2 dif Posted 02 November 2010 - 05:34 PM I have the code written for everything except when I try to display the highest and smallest numbers from the array into a label it display 0 for both the smallest and highest number.Question: Create an application that lets the user enter 10 values into an array. The application should display the largest and smallest values stored in the array.
*The form is a list box with 2 labels and a button to retrieve the 10 numbers and put them in the list box then the other button puts the highest and lowest number in the 2 labels
Note: Place them in 2 diff sub-routines.
Option Strict Off Option Explicit On Public Class Form1
[code]....
The only issue i have is to get the smallest number to show up.. mine just keeps showing "Zero".
I have the code written for everything except when I try to display the highest and smallest numbers from the array into a label it display 0 for both the smallest and highest number. Question: Create an application that lets the user enter 10 values into an array. The application should display the largest and smallest values stored in the array. *The form is a list box with 2 labels and a button to retrieve the 10 numbers and put them in the list box then the other button puts the highest and lowest number in the 2 labels
(I am not sure how to display line numbers in my code on VB2010, please if you know tell me and I will edit the post)
I'm making a program for a class, as usual. I need it to grab the smallest number, of the 2 inputted numbers.Well, there is 4 inputted numbers. For instance the user inputs the following:
Price Ounces 20 4 12 4
I divide the numbers, and get 5 and 3.The better buy is going to be item 2, as it is $3 per ounce.But I need the program to grab the smallest number AFTER dividing, and then display that in a label. I need to know how to grab the smallest number. What statement do I use?Odds are, it's something simple and I'm overlooking it.
I have 2 labels. One needs to show me the lowest number of the 10 in my rich text box and the other needs to show me the largest.
Public Class Form1 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub [Code] .....
The program is about a text file that contains the sizes of eggs. They task is to put each egg size into a category e.g. small, large, xLarge etc. Also i need to record the highest and lowest weighted egg.
I have don everything except find the lowest weight. Not matter what i try, i cannot seem to keep hold of the lowest sized egg.
here is my code :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim egg, jE, exE, lE, medE, sE, tE, high, low As Double
I have two text boxes on my form. text box 1 allows a user to type in a number (decimal) and text box 2 will display the smallest number typed in so far. The idea is to find the smallest number typed in by the user in text box 1, by using the Math.min method to compare each number typed in by the user to a variable that contains the smallest number to the point. Then replace the variable value with the smaller of the two numbers. To make it work for the first number. I have to initialize the variable to 99999. (no if else statements should be used).
My datagrid view looks like this :When I put the table to fill in word,my report looks like the table below, but I want my rank days are arranged from smallest to largest as in the table below :
Cod for filling
in the table word I use this:
Dim Tabela3 As Word.Table = WordDoc.Tables.Add(WordDoc.Bookmarks.Item("endofdoc").Range, DataGridView2.RowCount, 6) Tabela3.Range.ParagraphFormat.SpaceAfter = 0 Tabela3.Columns.Item(1).Width = WordApp.MillimetersToPoints(33.3)
Create a program where the user can find the highest number and the smallest number from a list of values It needs to operate as follows: Enter a value (number) in the TextBox and click on a button [Add to list]. Once this is done, the program analyzes if the number is the highest entered or the smallest. To view which is the smallest and largest, a second button [highest and lowest] will populate fields (texboxes) with highest and lowest numbers. I've attached an image of what the program should look like.
I`m make program for order form, I use order form code with name MR/IR/001, when I start Program It`s fine but when the order form code get MR/IR/999, It`s Stuck and won`t get increase the number, I want it the order form code go to MR/IR/1000, MR/IR/1001, MR/IR/1002 until 5000 how to get code work,
THIS THE CODE USING VB 2008 and database using MS access 2007
Dim strTemp As String = "" Dim strValue As String = "" Dim sql As String
My problem is I have a program that needs to input 3 values in 1 textbox only. I've been trying to figure that out for a couple of days now.this program must show the largest, smallest and average of 3 values.
Public Class Form2 Dim array() As Integer = New Integer() {a, b, c} Dim a, b, c As Integer
if i have 10 textboxes on my form with numbers inside 5 of them have the number "0" other 5 lets say 100 50 40 30 10 i need to get the smallest value but not the "0".
retrieving the smallest integer from an image data (image data has a data type of byte which means that numbers range from zero to 255) but if smallest integer is zero than the next smallest number which
I've been practicing how to use Loops. So I'm trying to create a program where a user enters 10 letters and I have to find which character has the smallest ASCII value.
example: If someone inputs "qwerTyuio" my output should display "T"
Now I think I got my program to get the ASCII values of a string but I can't figure out how to compare each ASCII value of each character.
Dim str, y As String Dim x As Integer str = txtLetter.Text
I have a bunch of 10 digit integers that I'm passing in a URL. Something like: "4294965286", "2292964213". They will always be positive and always be 10 digits. I'd like to compress those integers into the smallest possible form that can still be used in in a URL (aka letters and numbers are perfectly fine) and then uncompress them later. I've looked at using gzipstream but it creates larger strings, not shorter.
How to load file and save it as different filename? It saves almost twice the original size for some reason?
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim iFile As System.IO.File[code].....
Question 02:How to load it as numerical values?
Question 03:How to try applying an array of mathematical functions to the numerical values to see if size reduction is possible: I want to try testing all mathematical functions with any and all mathematical values of smaller size to see if the file can be compressed.
What I am trying to do is fill an array from the largest index to the smallest index -- with the desired effect of reversing the values in the array. I have been looking at doing it with 2 for...next loops and I thought I had it, but I don't. As the reversed array is empty at the end of the 2 for...next loops here is code that I have been playing around with.
Dim myIntArray() As Integer ReDim Preserve myIntArray(4) myIntArray(0) = 0 myIntArray(1) = 1 myIntArray(2) = 2 [Code] .....
I have an array called linedistancearray.I am now trying to find the smallest integer in that array and store it another variable called mindistance..The following is my initial idea: I sort the array and then pick the integer with index 0. Array.Sort(linedistancearray)However what I get is the first item being a 0 not the smallest integer value in the array I need. HOWEVER if I choose the index 1 it works.So what I was thinking was a way to remove all 0s in the array. I am not concerned about the order of the items at all all I am looking for is the smallest integer in the array.
I have 5 numbers, each ranging from 0 to 100. Each number changes from time to time. I have to sort them as highest first and smallest last. How would i do it?
I'm working on a project which generates numbers. When those numbers have been generated I would like to arrange them from smallest to biggest. Let's say 6 22 8 12 15 2 is generated. Then i want it to be re arranged to 2 6 8 12 15 22
This is the code I'm using:
PHP
Private Sub btnRandomClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSlumpa.Click Dim random As New Random
I create an array of this and load different distances into the ProjectileDistance property of the array. My question is this: How do i sort this array from smallest to largest value of ProjectileDistance?
I doubt anyone has specific experience related to this particular task, but maybe you can spot my problem. I'm trying to make a call to lithium (forum software) to place a vote in their poll, and their docs show this:[code]I'm not able to successfully register a vote and they say it's because the poll.choice param is not appearing in the header, but if I step through debugging, I see it in the Header Keys/Items just fine.
I'm completely stomped with the payroll program I have created. The NetPay variable is stuck on 0 and I went through step mode to try and fix it. No luck so far. Additionally I'm trying to turn the whole numbers, that the users input into the form, into percentages(such as 10 into .10, 25 into .25 ect..). Tried 1/x and (x * 10^-2) [code]
so i have a class called FOOTBALL,then another 3 classes/forms that inherit FOOTBALL, they control score (SCOREBOX), possession (POSSBOX), and quarter (QUARTERBOX).the FOOTBALL class has 4 variables, "score" (array of 2 ints), "teams" (array of 2 strings), "possession" (boolean), and "quarter" (int)after that i have another form called MAINBOX, which creates new instances of the 3 classes (SCOREBOX, POSSBOX, and QUARTERBOX) (like this: private scoring = new SCOREBOX)... however they all technically create their own FOOTBALL classes, so I cannot connect them.
I'm writing this program in Visual Basic .NET to organize different fields of data, and I'm using profile slots through application settings to store the data for users. But, I ran into a stack overflow error in my SlotSelect.vb class. My best plausible guess for why this happens is that I'm using the wrong kind of variable container in the below sauce code, but my dilemma is that I don't know what specifically is going wrong.The code that the vshost is saying is the cause for the overflow was written from some code that I looked up on MSDN and other places for referring to objects in other classes, and I tried using other variants of it to see if it was any different. So far, nothing has worked, and it doesn't stop the error while compiling, much less in the code markup--it only catches it when it starts the application in debug after it finishes building
i am using Visual Studio 2008 and VB.NET 2008 and SQL Server 2005 as the database. I just finished designing & writing codes for a customer's contract information and , however after it has been connected to the database only one of the datetimepicker can be click, (i put 2 datetimepickers to find date interval) and the rest of the function including in the form are not working! it seems that the form stuck and NOT responding. i cant even close the form using the X button, so i have to stop the process using compiler (visual studio 2008), however if i press the 'Delete' button before the 'Add' button, it will successfully delete the data..