I want to get the n highest values from an integer array that has n or more elements. This can obviously done by sorting an slicing the array, but I'm wondering if there is a more efficient way to do this, since sorting a whole array would be quite ridiculous when for example only the top 2 elements of an array with length 4200 are asked for.
I'm working with a zedgraph bar chart and displaying only certain values from a dataset. I have a dataset with 912 records. One field is called "DeviceName" and one is called "TimesOffline". I am able to bind the chart to the dataset, but it wants to plot all 912 records. What I need is to somehow sort the dataset to retrieve the top 10% (or something) devices with the highest number of times offline.
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 currently working on a project in which at one point, the user may right click a button which brings up a contextMenuStrip. I am already able to find the owner accurately from that strip, and manipulate the button clicked as follows:
Dim myItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem) Dim cms As ContextMenuStrip = CType(myItem.Owner, ContextMenuStrip) Dim buttonPressed As DataButton = DirectCast(cms.SourceControl, DataButton)
But now for the tricky part. Within this contextmenuStrip, I have a DropDown menu with multiple items in there. I would assume you would be able to work your way up the ladder doing casts like above in the manner of
Unfortunately, when I try to get the sourcecontrol from this menuStrip, it return Nothing. Any ideas on how I can get the button that was pressed from this toolStripMenuItem? My current code is as follows (in which the sourceControl is Nothing)
Dim myItem As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem) Dim dropDown As ToolStripDropDownMenu = CType(myItem.Owner, ToolStripDropDownMenu) Dim menuItem As ToolStripMenuItem = CType(dropDown.OwnerItem, ToolStripMenuItem) Dim cms As ContextMenuStrip = CType(menuItem.Owner, ContextMenuStrip) Dim buttonPressed As DataButton = DirectCast(cms.SourceControl, DataButton)
how to go about doing what I did in that first method, but just working my way up from further down the ladder?
I'm having a problem with my Access database.I have to select the highest ActieAantal before the last action ( )because the last action is always the sum (Totaal).this is a part from my table
The next person also has some acties with corresponding Actieid and a Total when I use this query I alway get the 999 values
SELECT Register.Persoonid, Max(Register.ActieAantal) AS MaxVanActieAantal FROM Register GROUP BY Register.Persoonid ORDER BY Register.Persoonid, Max(Register.ActieAantal);
but when I try to exclude the 999 value I get nothing
SELECT Register.Persoonid, Max(Register.ActieAantal) AS MaxVanActieAantal FROM Register GROUP BY Register.Persoonid HAVING (((Max(Register.ActieAantal))<>999)) ORDER BY Register.Persoonid, Max(Register.ActieAantal);
find the highest 'ActieAantal' after excluding the 999 values?
I have tried following coding to get highest value.EX: If I type 4.341111111111, It should get the value 4.35. If I type 9.132222, It should be 9.14 not 9.13.[code]
getting a formula round off to the next highest .25.example:
2.35->2.50 2.26->2.50 2.24->2.25 2.51->2.75
I can't use the Round function because if I have 2.26 then it will round off to 2.25 which is unacceptable.I have been using the Ceiling function but it rounds it off to the nearest highest integer. Which can add an almost extra kg,lb to my formulas.
I have a table named as table1 with IDNo column and the ID numbers starts with HL, EL, EE, HE plus the year and a four digits. [code]On form load, the user will select from radio button which category he/she would like to work on, whether HL, EL, EE, HE. Let's say that the user selected HL, I would like to get the highest number in table1 and extract the last 4 digits truncating any zero digit starting from the left side and update table2's sequence column with the extracted value.
I got this code to get the highest value from a dataset, but it now doesn't work properly. I think it only gives me the last row but not the highest value.
Dim adMaxRec As New SqlDataAdapter("select serviceid from service", nwindconn) 'where custid = '" & cutidtext & "' Dim dsMaxRec As New DataSet adMaxRec.Fill(dsMaxRec) Dim maximumrecord As String maximumrecord = dsMaxRec.Tables(0).Compute("Max(serviceid)", "")
Im am currently coding an application for auto updating ccleaner. Everything worked well until I enabled UAC.. I am using this project: [URL] to schedule the updating process, but when uac is enabled I get every time a message if I would let ccleaner installer make changes to my computer. The auto updating process must be done silently without bugging the user with prompts of uac.
When i manually check the "run with highest priviliges" box in task scheduler it does run without a prompt. But I can't seem to do this programmatically. Or I havent found it yet.
how to get the highest date of txt file how to get the max value of arrayForTheLine(3) in 14 lines( that's mean count highet date line - 14) and when i get the max how to get the date of the line that has the max value this the file
I created a code that inserts a number into a row every time someone submits a form.I am able to read the data back to the form using a loop.My confusion is I would like to get the highest number from the data field(column)Lets say the Field(column) has five numbers from 1 to 5.How do I get the highest number?I was looking at using a loop to go through the field and bring out the highest number, but should I use an array?
label10 displays which is the highest number label12 displays which is the lowest number label14 displays which is the number that is duplicated
My codes don't run 100% correct.:'( Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label6.Text = Val(TextBox1.Text) Label7.Text = Val(TextBox2.Text) Label8.Text = Val(TextBox3.Text) [Code] .....
my list box consist the person's name and his score that get from another button.. and I wan to search for the highest score only in another button... what codes should I code in??
this code is for add the details into list box
"Dim name As String = txtname.Text.ToString Dim total As String = lbltotal.Text.ToString Dim x As Integer Dim duplicate As Boolean = False
[Code]...
how can I search from the list box to find the highest number onli?
What is the right way to find Highest decimal number out of 10 different numbers(or more)? I made this code below, and surprisingly it doesn�t work every time! All numbers are declared as decimals but some times 0.02 is a higher number then 0.11!
If n2 > (n3 And n4 And n5 And n6 And n7 And n8 And n9) Then TextBox11.Text = n2 End If
The application I'm doing requires me to "enter the size of an array in a TEXTBOX, then click a button, a list of random number would show up, then re-arrange from Lowest to Highest".For ex, i enter "5" in the TextBox, then an array or list of 5 random number will show up vertically on the ListBox. I already got this part done. Now the thing is, I have to make a For...Next statement to rearrange them from Lowest to Highest.
I want to sort the individuals according to their fitness values descending. ' Declaring a structure Public Structure AnIndividual Dim XCoord() As Integer Dim YCoord() As Integer Dim FitnessValue As Double End Structure [Code] ..... Each individual has a fitness function and has its own X and Y coordinates. I just want to say if individual six (for example) has the lowest fitness value then rank this individual the first one and so on for the rest of individuals.
Now This Array is populated with decimal values and i just want to get the index values of the highest and lowest scores.i.e. if the [[scores(3) = 90]] and [[scores(7) = 90]] are equal and highest scores, i want 3 and 7 as integers in return..and same for the lowest scores..I retrieved data from a text file and stored it in Classes.. now i want to relate the above Array and these Classes..
Dim Student1 As New Student
There are total 20 of these classes.. Student2.vName, Student3,vName.. etc etc
For example, After i get the highest score indexes from scores(19) array i would like to get the name of the related person from Student*.vName Class (If i get 3 and 7 index i the related names would be Student4.vName and Student7.vName consequently)?
I have a problem that can be best solved with LINQ. I have a class that has 2 properties of which 1 is a single. I have a collection of that class and I need to select the instance with the highest single value.[code]I'm having a hard time explaining this even this is a simple task. Please ask if you don't understand.In addition to my original question, How would I create a collection containing the 5 highest Instances.
I have a file which has numeric values like [code]What would be the best way to display the highest number in a textbox +1?I have the following coding but to be honest it just keeps showing random numbers in the textbox.[code]Also what would you be the best way to append to the file? I have the following coding to append to the last line.[code]
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?
See I got a box and in the box is it a textbox and 2 buttons, one of the button is named open (open a txt file) and the second button is add ( add the names in a rich text box) So my idea is, when i got a txt file with full of names like:
Bob James Blabla Duck etc etc
and want to upload by my upload button and when i have done that... so will one of the 4 names i have added appear in the textbox. After... if i click on the add button the name will appear in the richtextbox, and then will textbox refreash and take a new name of the 4 names.
I am trying to write some Linq to SQL that will bring me back a list of rows containing a single instance of BaseQuestionIDs but I want the row with the highest version, so, from the following table of data:
Id CreatedDate Version BaseQuestionID 2 2009-10-07 13:47:27.687 1 2 3 2009-10-07 13:49:35.010 1 3 4 2009-10-09 16:03:45.973 1 5
[code]...
I want to return:
Id CreatedDate Version BaseQuestionID 2 2009-10-07 13:47:27.687 1 2 3 2009-10-07 13:49:35.010 1 3
[code]...
I have tried a variety of things, but have not nailed it yet. I am working in vb.net?