I'm using VB.NET with .NET 2.0. I have two lists, and I want to compare the lists on a specific property in the object, not the object as a whole, and create a new list that contains objects that are in one list, but not the other.
Result in the above example would contain one customer, Jane Doe, because the identifier 2 wasn't in the second list.How can you compare these two List<T> or any IEnumerable<T> in .NET 2.0 (lacking LINQ)?
I accept both C# and VB.NET suggestion, even though I'm writing an app in VB.NET I have two lists of intergers
List1 {1,2,3,5} List2 {2,4,6,7}
I want to have new List3 {4,6,7} which is composed of elements of List2 that are not in List1. I know I can write a nice For Each loop for this but I want it done in LINQ I've been looking for such methods at Enumerable Methods, but I can't find it.
I have two array list same size, depending on the information gathered by previous functions. The size of the arrays range from 2 - 45 in length, both arrays always have the same length. I am trying to match one string in one array to another string in the second array. When they match then add Item to List.
Here is my Do Until i = Arraylenght info = Replace(myAL(s), " ", "") SortedArrayList(m) = Replace(SortedArrayList(m), " ", "") SortedLine = Split(SortedArrayList(m), "Price=") If myAL(s).Contains(SortedLine(1)) Then [Code] .....
This code works up to an array of not more then 4 in lenght, when working larger size array then 4, the minute it get to 5 I get this Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
I have two lists of strings. One is a list of all students in a class and the other is a list of students in the class that completed an assignment. The two lists are part:whole. So we have two loops for copying elements and displaying them in a list box for only the students who did submit.
Dim f As Integer f = 0 Dim h As Integer h = 0 While (usersinclass.Count > f) h = 0 While (usersidthatsubmittedassingments.Count > h) [Code] .....
What I need is the remaining portion of the "usersinclass" list. (i.e. The students who did not submit). I tried an Else statement BUT with nested loops, every element is guaranteed not to match at least once, so I was getting elements that shouldn't be there. So, is there anyway to run the given lists against each other again to pull out the remaining students? (preferably with no repeats).
I am new to vb and I am having so much trouble with this. What I need to do is this: I have a form application for winter sports equipment rental.I have a listbox filled with the equipment for the user to choose from then I have a combobox for the user to select the duration they would like to rent it. The book that I am using has no examples I can refrence and i have had no luck online either. I am posting what I have so far. However, i think I am going in the wrong direction. I have been working on this for so long that I think I have over thought it and made a mess of it. I am thinking that I need to add a new class for rentalRates then use enum of durationType and equipmentType but I am unsure how to move that way. That is using a enum, a 2d array and a parallel array? [code]
I have a form as follows "Price changer" The user is allowed to select a product and enter price . So when the change price button is clicked...the price is stored in a array which is later called
So what i am stuck is when the user selects a product from the drop down menu...the user can enter price . But i need to display a error message when the user enters text instead of numbers for prices. I tried try parse method but it displayed the error message but did not transfer the entered price to the array.
My code is as follows
The bolded intMediaprice() are arrays....
Private Sub btnPrice_Click(sender As System.Object, e As System.EventArgs) Handles btnPrice.Click If cbMedia.Text = "8-Track" Then
I have to create a form that I enter the price of gas each month over a year. I enter the price in a text box and click the enter button to send the price to a list box immediatley and use an array. I have the following code but I don't think it's working with the array correctly as it will let me enter the information but doesn't stop letting me enter after the 12 prices. I am really having a hard time trying to figure out how to set up this input for an array and make it all work.
I have two lists. One list is a list of names, the other list is a list of how many times each name is found in the first list noted in the database
so... Nick John Jim Jack
is the firs tlist
10 13 13 2
is the second list. Nick had 10, john 13 and so on.I want to sort the second list from large to small, but have the index for the first list still linked to the correct amount of calls.i do it this way so I can
for x = 0 to num_of_names string = lst_name(x) & "-" & lst_count(x) next x
I know how to check whether an item exists in a list using (MyList.Contains), But I do not know how to check the whole list. For example (use one button and one richtextbox):
I got a program I am working on. It does some calculations using quantity and price in such. Heres the calculation module. Private Sub calculations() If AdultsizeRadioButton1.Checked = True Then adulttotaldecimal = quantityinteger * adultpricedecimal * hoursinteger ElseIf ChildsizeRadioButton2.Checked = True Then childtotaldecimal = quantityinteger * childpricedecimal * hoursinteger [Code] .....
Ok, everything has worked when I display the information.... up until the accumprofitdecimal variable. When i display that value its NOT what it should be. For instance i'm putting in a quanity of 1 and an hour of 1 for an adult then for a child, the extended price comes out properly as $2.15 now the code accumprofitdecimal += extendedpricedecimal SHOULD add the extended price (2.15) to the accumulative total. but when i display the accum profit total it shows a number that makes zero sense... is accumprofitdecimal += extendedpricedecimal not correct code?
I want to make a program(Program A) that allows you to use another program(Program B ) for an amount of time, then shuts it down. I already know how to shut down ProgramB down during runtime, now all I need is the part where Program A automaticly starts when Program B is opened.
Here me again since i'm done now in Sign Up form.Another database coding to add a records..i try to copy the same code with my sign Up form to insert a records....to input a Litre and Price. is this correct?
Public Class frmGasolineSales
Private Sub slc(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim thistabcontrol = CType(sender, TabPage) Select Case (thistabcontrol.Name) Case "TabStation1"
Check this code and please tell me a solution.I have 2 buttons (Pizza & pepsi),the price should display in textbox8 when i click on button, here the price had shown in Textbox8,but it is not getting added with next price when i click second button. PrivateSub Button4_Click(ByVal sender System.Object,System.EventArgs) Handles Button4.Click
i have four price values in a drop down list and i need to code these values and add them to values from a checklist object i am doing very simple coding ?
The program is for calculating an amount of fruit. I have a label saying the name of the fruit, a textbox to enter a value of 0-99 and another textbox with ReadOnly which will show the price.
A little picture here:[URL]
As you can see, the Fruit1 Etc... Is only the fruit name. The Text box wich indicate 1-99 means the number of fruit. The Textbox with Cash on it, means the total price. The Calculate button, when I will push it, all the total price from all the fruit will be added together to form a total price which will be indicated in the total price textbox under the Calculate button.
When I will enter the number of fruit, if I enter 99, it give me a price. When I will enter 60, I want that the 60 are multiplied by (let say) 0,10$ I just like to know how I can do this... Its really bothering e and I don't want to calculate all the things and make 99 line for 1 fruit cause it will be long.
The code I was using was: Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If TextBox1.Text = "99" Then TextBox2.text = "10.00$" Elseif TextBox1.Text = "98" Then TextBox2.Text = "9,90$" EndIf End Sub
Until the the number of the fruit in the code reach 0. So its very long.
I'm reading "Programming with Microsoft Visual Basic 2008". At the end of each chapter there is excersize that I don't have the answers sheet for. Anyway, the first one is: A procedure needs to store an item's name and price (which may have decimal places). Write the appropriate Dim statements to declare the necessary procedure-level variables. What I have so far is: Dim "Candy" as String
So I have an issue with have displayed names in a listbox and trying to write a code to have a hidden price value for it. I want the selected name in the be put into another listbox as a display name and have the price value of it be in a holding value to calculate an equation.I just need help declaring the name with a value in the list box. And How do I list each listbox number so I can retrieve it back as a price value to put in a formula.
Private Sub btnAudioAddCart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAudioAddCart.Click Const decPrintIDidIt As Decimal = 11.95D 'Price of Print Book "I Did It Your Way" Const decPrintHistory As Decimal = 14.5D 'Price of Print Book "The History of Scotland" Dim intAudioInput As Integer 'Holds the selected Printed Book
I have programm what calculates KiloGramm price.It works so that if I enter the amount(in KG) and price then it calculates the Kg Price. But it calculates wrong when I insert "," not "." . My programm code is so:
Dim MonPrice As Decimal If RadioBtnMon20.Checked Then TxBxPRICE.Text = TxBxPRICE.Text MonPrice = MonPrice + 120 ListBox1.Items.Add(RadioBtnMon20.Text) [Code] ..... I want to add only one price if selected but with this one if i choose another option then its keep adding price instead of removing previous price and put selected price..
I am writing a program that uses an array of structures to display a price in a label based on what item is selected in a list box(the data is stored in a text file). I am having trouble figuring out how to make the price corresponding with the item appear in the label. Currently, it just keeps showing the last price in the text file.
I am attempting to code a VB project for one of my classes. The assignment is to write a program that take the input of Wholesale cost and markup percent, then calculates retail price. When I finished the code, any input I use results in the retail price showing as $0.00.
Public Class Form1 'Declares a variable to hold the wholesale value Function wholesaleIsValid() As Boolean Dim dblTempValue As Double
I have a form with check boxes and behind the check box i assigned it to a const Price. I have a Total Label box and I want to check to check boxes and add them to the total label
I have about 80% of this app done. All I need to do is convert what the user inputs of the wholesale cost of the item (lblCost and txtCost) and and convert that and the retail price to its markup %(lblMark and txtMark)