I am working on high Frequency data. I have a matrix with their values as zero or non-zero. I have generated Matrix using Data Tables and Displayed in DataGridView.
Now, my Column Headers are as follows 5000, 5100, 5200, 5300, 5400....6000
similarly my Row Headers are same as column headers 5000, 5100, 5200....6000
I am looping for each row and than each column and want to store value of each cell with their column header in an Array.
Than, I want to sort array based on values in descending order.
Now Problem is - When values are same(duplicate) for more than one cell in same Row.
So, I want to store column Header with values in an array. If, there is a duplicate value than sort on column header.
In this way, I can avoid conflict in sorting and can easily retrieve value of Column Header
how to assign values and column header value to 2 dimensional array
I am writing an auto insurance application.I need to sort a three dimensional array in descending order based on an integer value in third field in the array.The CalcPremium function returns an integer value.
I'm trying to figure out a way of randomly selecting one text box from 4 text boxes. But with one of them having 70% chance of being selected, the other three just 10% each.Have searched this forum, the closest I could find was, it's a bit over my headThis is as far as I can get. Can someone with better ability (not hard),Is there any simple way around this, using some sort of random object search stating the the textbox that needs a higher likely hood of being picked, many times over?
I am having a bit of difficulty figuring out a way to calculate the weighted probability (weighted "random" numbers) and apply it directly to the selection of a given line of a text file. In short, I wish to have a text file, where each line has it's own probability of being chosen (obviously not all would be the same). I wish the probability to be dynamic, and based off of thirds. As in, say I have 9 lines in a given text file, and I wish to weight the probability of the first three to be significantly higher than the 2/3 and the 3/3 portion of the text document.
Example: Line 1 20% Line 2 20% Line 3 20% Line 4 10% Line 5 10% Line 6 10% Line 7 3.3% Line 8 3.3% Line 9 3.3%
With the above logic, first 1/3 of the lines = 60% sum total, middle 2/3 = sum total of 30%, and the last 3 are a sum total of 9.9% repeating. How would I go about achieving this dynamic assignment of probability, and choosing them randomly, based off of the given weight?
I wrote the following generic LINQ extension for calculating weighted average in Visual Basic 2010: <Extension()> Function WeightedAverage(Of T)(ByVal source As IEnumerable(Of T), ByVal selectorValue As Func(Of T, Integer), ByVal selectorWeight As Func(Of T, Integer)) As Double Dim weightedValueSum As Double Dim weightSum As Integer [Code] .....
How can I call this function as an Aggregate function of another LINQ query? I tried it in the following way: Dim q1 = From jd In oContext.JobDatas Where jd.Year = 2011 Select jd Dim q2 = Aggregate num In q1 Into WeightedAverage(num.AvSalary, num.NumPosHolder) The Visual Basic 2010 editor is telling me that the second query (q2) of the following code is not valid statement. On the comma between the first an second argument it's saying: ")" required.
I have a string containing many lines. Each line has many values separated by commas. Basically it's in CSV format. The number of lines is variable but the number of columns is always 7.
I can get each line into a one dimensional array using Split(Var, Chr(10)).
I'd like to make it a two dimensional array where the second dimension contains each comma separated value.
I've got
Dim VarArray1() As String = Split(VarText, Chr(10)) Dim VaryArray2(0 To VarArray1.Length - 1, 0 To 6) As String
Is there a quick way to get the contents of VarArray1 into VarArray2. I know I can do the following.
For Counter = 0 to VarArray1.Length - 1 Dim line as string = VarArray1(Counter) Dim Values() as string = Split(line, ",") For Counter2 = 0 to 6 VarArray2(Counter,Counter2) = Values(Counter2) Next Counter2 Next Counter
But is there a quicker way to do it that doesn't require passing through each element of VarArray1 and then passing through each element of Values.
The eventual goal in all of this will be to find the highest value in the 3rd column (the arrays are strings at this point because not all columns are numeric). To do that once I get the values into VarArray2 I suspect I have to pass through each element VarArray2, i.e. VarArray2(Counter,2). Unless I can copy the whole third column into a SortedList?
i have a problem with my system.. i have try many time and i cannot solve the problem..here is my question
Use one dimensional array to solve the following problem: A company pays its salesperson on a commission basis. The salesperson receives RM200 per week, plus 9% of their gross sales for that week. For example, a salesperson who grosses RM5000 in sales in a week receives RM200 plus 9% of RM5000, or a total of RM650. Write a program (using an array of counters) that determines how many of the salesperson earned salaries in each of the following ranges (assumes that each salespersons salary is truncated to an integer amount):
A) RM200-RM299 B) RM300-RM399 C) RM400-RM499 D) RM500-RM599 E) RM600-RM699 F) RM700-RM799
I'm having my program sort an excel sheet by a few columns. However, it is only sorting by the first column not the rest that I specify.ere is my sort code below:
I have a WPF ObservableCollection which is bound to a ListBox and I have a Sort() method which when called will convert the ObservableCollection to a List(Of T), and undertakes a sort based on a date/time column within the collection.
The data is sorted, even when new items are added to the ObservableCollection, however the date/time isn't being correctly sorted. The data is sorting based on the date however it is very much random when it comes to the time portion. The following is an example of the outcomes I am experiencing:
[Code]...
Is there anything that I am doing incorrectly in this method that would cause the time portion not be included in the sort? Is there a better way of doing a sort?
i'm extremely confused. my professor gave us this as the FIRST problem to do in this intro to VB class...on page 380 of our text. use a one dimensional array to solve the following problem: a company pays its salespeople on a commission basis. the sales people receive $200/week, plus 9% of their gross sales for that week. for example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, a total of $650. write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assuming that each salesperson's salary is truncated to an integer amount): $200-299, $300-399, $400-499, $500-599, $600-699, $700-799, $800-899, $900-999 and over $999.
Allow the user to enter the sales for each employee in a TextBox. The user clicks the Calculate Button to calculate the person's salary. when the user is done entering this information, clicking the Show Totals Button displays how many of the salespeople earned salaries in each of the above ranges.
Is it possible to have a two-dimensional array/list/collection such as the following. The first dimension is to have 2 elements, 0 and 1. The second dimension I would like to be able to have a different number of elements for each of the elements in the first dimension. To explain better, I'd like X in array (0, X) to go up to say 4 and Y in array(1, Y) to only go up to say 2.
So there would be: array(0,0) array(0,1) array(0,2) array(0,3) array(0,4) array(1,0) array(1,1) array(1,2) But no array(1,3) or array(1,4).
I'd also need to be able to use Redim Preserve to increase the size of the second dimension for each of the first dimension's elements.
I'm trying to display in a list box a two dimensional array using format string.The information for my array I'm getting from an external file.this is what I have, and I don't know how to fix this.
Sub DisplaySeatChart() Dim fmtstr As String = "{0, -15}{1,-15}{2,20}{3,-15}{4,-15}" For i = 0 To 9
I'm working on a program that generates random values for a byte array thats length is 16.I have already devised the generation method, but I want to use My.Settings to store this...but I haven't seem to have located Byte() for My.Settings.
I'm in the middle of making a battleship game, and I'm trying to get picture boxes .visible=True based on the coordinates (that have already been given a nice Try/Catch/Finally error handeling block) of the ships. Example: I have picture boxes in a grid formation that are all red, and my naming convention for them is picR00 for the coordinates (0,0), picR01 for the coordinates (0,1)... et al. Because I'm using a(10,10) for my boolean array, I want the stuff thats false (not marked), those coordinates' red picture box to become visible, and the true have the green ones become visible. Here is what i have so far:
Dim a(10, 10) As Boolean, b(10, 10) As Boolean, c As Integer, x As Integer, y As Integer, ox As Integer, oy As Integer For c = 1 To 3
win app where user loads files from win explorer into a datatable bound to a datagridview. After loading the files, each filename is parsed and split into different fields and finally sorted w.r.t. to two its columns. One column is filled with error codes and depending on these, the cells that contain errors will be marked redIt's a three-step process where I just described step one.In step 2, the user will edit the data and hopefully correct the errors, cell by cell, according to some rules and here it's where my problems start. Since I sort the table in step one, sorting is activated and each time the user changes a value in one of the sorting columns the table will do a resort, messing up some of the editing done by the program (cell background color etc.) confusing the user.I have tried to use several of the datagridview events (mainly the cell and the row events) and also to turn-off the sorting by setting its dataview.sort="". Neither of my attempts has been complete successful so far.
I need to have "press" grouped (all jobs for press #1 then #2 then #3). Then have the grouped press jobs sorted by date ascending (all Mondays jobs together, Tuesdays jobs, etc.)When I change: Me.~my~BindingSource.Sort = "print date" to Me.~my~BindingSource.Sort = "print date, press"My datagridview groups the press rows together and lists everything in ascending order according to todays date just fine, except it won't show the first job with today's date at the top of grid. It will start somewhere within the today's date entries. I then have to scroll up 4 or 5 rows to see the first job with today's date.
But if I change my PC's calender/clock to any other day (past or future) it works perfect, first job at the top, all presses grouped together. Set clock back to current day and time and again it will start somewhere within the today's date entries.
Me.~my~TableAdapter.Fill(Me.~my~DataSet.~my data~) '---Sort by "Print Date"--- Me.~my~BindingSource.Sort = "print date"
I have a gridview in my asp.net website that and I use vb for the code behind. Each time a row is bound an even called the Gridview_RowDatabound event is fired. So what I am doing is looping through all the cells in that row: [Code]
Problem is I get an error saying redim can only change the rightmost dimension. It would suit my needs to change both dimensions here as my final result will be to total each column in the array. what other method can i use if arrays don't suit this task.
Ok so I know that you can sort by using a bunch of different sorting algorithms but I just am not sure how to start this off. I have written this code and just want to know if you can even sort this.
The program takes the users information in from text boxes from another part of the program and writes the information into a text file. So when the user clicks on this button it will display all the people that have entered in their names. I want to sort their last names alphabetticaly.
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListCustomers.Click
I am however struggling to sort a list using 2 parameters within a lambda function. The properties within my list that i need to sort by are Category and then by Cost. how to do this?
I have two rich text box, and a button. I want it so that, if I click on the button, everything on first text box, would be on 2nd text box. BUT, if there's a similar line. It would only show one line, except it would have "x#" where # is the amount of times it's duplicated.
What i am doing is to enable a user to specify in a combobox on a form a threshold (integer). On a button click the code steps through a datatable until the cumilative value of a field in the records row are equal or dont exceed the figure specified. It then selects these rows and presents them in a datgridview in another form. This all works just fine.
What i am struggling with is undertaking a sort on another field before it starts the filter part. It appears to revert to the default order. Here is my
If ComboBox1.Text = "Co2 saving in tonnes" Then Dim table As New DataTable Dim limit As Integer = ComboBox2.Text ' Your threshold
Ok so I have this program that shows data in a treeview and that data is from a datatable.I'm basically looping through the datatable row by row and adding nodes.The data looks something like the following:
[code]...
I have a thread that is hitting the Database (where these records are stored) every 5 seconds to see if the list is smaller,bigger or changed.If so, I was just recalling the load_form sub but this was taking too long as the lists could potentially be very large. Also, there is a lot of logic that comes into play depending on what user is displaying the records in the treeview.I was wanting to know what would be the fastest way to compare the datatable that was previously used to initially create the nodes in the treeview to a tempdatatable that has the currently updated/added/removed rows and update the treeview accordingly?The only thing I could come up with was basically looping through the tempdatatable and comparing each row to the rows in the original datatable and plucking out the ones that had no match.Then recursively looping through the nodes in the treeview to find the spot that the new node should be added (based on that datarow's values).Or is there a better way to do this and I should scrap this?
The following code retrieves all USB hubs on a PC and adds them to a treeview:Dim USBHubsearcher As New ManagementObjectSearcher("SELECT * FROM Win32_USBHub")For Each queryObj As ManagementObject In USBHubsearcher.Get() SystemTree.Nodes(0).Nodes("USBHUB").Nodes.Add(queryObj("Description"), queryObj("Description"), 4, 4)Next What I want to do is to sort the results by "Description" so that they are listed in alphabetical order. ORDER BY does not work as it is not part of WQL.
currently I was able to Sort GridView and it is having several page. what my brilliant boss want is to SORT the records per page... as in per page... (ex. page 3 of the gridview contains 50 records of data (G-J), she want to sort the 3rd page for the records to become (J-G) just for the 3rd page...)
One displays a list of contributors for a charity and the amount given in a text box.However iv created another button but i need this to sort the list of names to just display the names and in alphabetical order.