C# - Get Subset Of Elements After Performing Remove()?

Jun 21, 2009

If I have code like this (C# or VB.Net does not matter)

Dim e As IEnumerable(Of XElement) = _
From s In _dataSourceSettings.Elements _
Where s.Attribute("name").Value = toInsert.Attribute("name").Value
If e.Count > 0 Then
e.Remove()
End If

How do I get now new _dataSourceSettings without element that I removed?

View 1 Replies


ADVERTISEMENT

Filtering Array To Return Subset Of Elements In .Net 2.0

Mar 2, 2011

I have the following in a .Net 2.0 app:

Private chequeColl() As Cheque
For i = 0 To m.Length - 2
chequeColl(i) = New Cheque()

[Code]....

I now want to make chequeColl only contain those items where Status is not equal to 41. In LINQ this would be easy but I can't think how to do it.

I cannot use the .Net 2.0 LINQ bridge products, I have to do this the old school way. At the end of it chequeColl must only contain those items that are not status of 41. I cannot have empty elements.

View 3 Replies

Remove Elements From A List?

Feb 6, 2010

I have a List of a custom class (barData) that I need to remove elements form based on a date.

The bardata class holds data of stock price information.[cod]e...

Is there a way to do it without looping through each bar as I may have 2000 plus bars for each stock and may have 2000+ plus stocks to look at. It can be done by looping but it is slow.

View 2 Replies

VS 2010 - How To Remove Nothing Elements From Array

Oct 20, 2011

How to remove the Nothing elements from an array using a For or For Each loop? I have to display the array to a datagrid, but the Nothing elements of the shows up as zeros. This is the code I have so far for my button click event:

Dim flag As Boolean = False
Dim found As Integer
For m As Integer = 0 To carArray.Length - 1
If carArray(m).carid = txtDelete.Text Then
carArray(m) = Nothing
flag = True
found = m
End If
Next

View 11 Replies

Remove Empty Elements From Char Array?

Sep 26, 2011

Remove empty elements from char arrayI have this [code]...

View 6 Replies

Use The RemoveRange Function To Remove A Couple Elements From A List?

Feb 2, 2011

I use the removeRange function to remove a couple elements from a list, but the Count of the list seems to be intact, so I assume it didn't work the way I expected it too.... so, how do you remove elements? I mean, reduce the list's Count value ultimately.

View 3 Replies

.net - Repository Pattern - Remove Child Elements From Multiple Parents

Nov 16, 2011

I have the following tables

Public Class Tag
<Key()> _
Public Property TagID As Integer

[Code].....

I implemented the repository pattern.

Now i have a list of Tags which contain the right TagReferences, but the tags may not be deleted, it's the TagReferences.

Variabels = ReferenceValue,ReferenceID
IEnumerable(Of Tag) = TagRepository.GetMany(Function(el) el.Reference = ReferenceValue And el.TagReferences.Any(Function(bl) bl.ReferencedID.Equals(ReferenceID)))

How can i remove all the TagReferences which contain the ReferenceID in one line?

View 1 Replies

Remove Specific Elements From HTML With Agility Pack For Program?

Sep 21, 2011

There seems to be no documentation on the codeplex page and for some reason intellisense doesn't show me available methods or anything at all for htmlagilitypack (for example when I type MyHtmlDocument.DocumentNode. - there is no intellisense to tell me what I can do next)

I need to know how to remove ALL < a > tags and their content from the body of the HTML document I cannot just use Node.InnerText on the Body because that still returns content from A tags.[code]...

View 2 Replies

Html - Dynamically Created Elements From Codebehind Need To Be Inserted Between Specific Elements

Sep 17, 2010

I created a method and pass the element type, id, and any inner text that instantiates a new html element. The last statement: Me.Controls.Add(element) adds it to the end of the page, but I would like it to be inserted in a specific position (between 2 divs within a form). What I am describing is very similar to this post on SO here, although it was for javascript.

View 1 Replies

Getting Value From Subset Of Arraylist?

Mar 5, 2012

how to achieve what am trying to do below. am trying to have a set of numbers in different list into and array. so i can select any list in the array as random and get the values in the selected list.

Dim list1 as New List(Of Object)
Dim list2 as New List(Of Object)
'adding items to list 1

[Code]....

View 3 Replies

.Net Linq - Doing Operation On The Subset

Jun 16, 2010

I need to have the following : (name1 + "a") + (name2 + "a") + ...

Dim separator() As String = {"|"}
myString.Split(separator, StringSplitOptions.None).SomeLinq(...)

I don't know what to add at the end to add an "a" to each element...

View 2 Replies

C# - SQL To Filter A SubSet Of Data?

Jun 2, 2010

I have an arraylist that holds a subset of names found in my database. I need to write a query to get a count of the people in the arraylist for certain sections i.e. There is a field "City" in my database from the people in the arraylist of names I want to know how many of them live in Chicago, how many live in New York etc.

how I might set up an sql statement to handle this. I think somehow I have to pass the subset of names to sql somehow.

Here is a sample how I am writing my sql in my code

Public Shared Function GetCAData(ByVal employeeName As String) As DataTable
Dim strQuery As String = "SELECT EMPLID, EMPLNME, DISP_TYPE, BEGIN_DTE FROM Corr WHERE (EMPLNME = @name)"

[Code]....

I need a way to create a function using your sql statement to return a datatable object of names and the parameters would be city, and the List of names.

The above example isnt the sql I am looking for its just a skeleton of what the function would look like that I want to create.

So then you would use the function by iterating through all the cities passing in the same set of names each time in the fron end.

View 5 Replies

Output Each Subset Of The List

Feb 16, 2011

I have a list and I need to output each subset of the list for example a b c d e would output to

[Code]...

I believe the correct term is combination no element should be duplicated on the same line I was going to attempt this with a series of loops but im not even sure wehre to start

View 3 Replies

Search Through A Subset Of Properties For A Given Value?

Aug 12, 2010

I am working with the MP3IDV1 class from this link: [URL] I am pulling the ID3 tags from music files, and this class returns the Genre in number form. However, it has the property Genres with that entire list.

Public
Enum
Genres As

[Code].....

View 5 Replies

VS 2010 Get A Subset Of Into Another DataTable?

May 19, 2011

I have a DataTable that I need to get a subset of into another DataTable to bind to a control. Is there an easy way to do this?

View 4 Replies

Bind Gridview To Subset Of Array?

Dec 9, 2010

I have an array of objects I get from a web service. The 1st element in that array is meant to be displayed in a asp.net literal control. The rest of the elements are meant to be bound to a gridview.

View 1 Replies

Code To Find Subset Of String

Aug 22, 2011

I am working on a function that returns an array of variable-length strings that have a certain starting and ending delimiter. The input to the function is a string. I am able to do this by using if-then statements with InStr(). I was wondering someone knew of a more elegant way. I tried using the split command but I am splitting on one delimiter so I don't really get the result. I could then parse from the results but I am back to the same boat with using InStr().

[Code]...

View 1 Replies

Pass Subset Of An Array To Function?

Jun 25, 2010

I have a simple VB.Net Form that acts as an interface to a control library with a public API.

One of the API calls takes an Array of UIntegers ByRef:

Public Function Get_Values(source_id As Byte, first_value_address As Byte, number_of_values As Byte, ByRef valuesOut As UInteger()) As Integer

After the call, valuesOut will hold a list of values number_of_values long from source_id starting at first_value_address.

There is a hardware driven limitation that the max number of values returned is 15 regardless of requested length. I need to get 28 values into an array from my VB.Net code.

Is it possible to send only part of an array variable to the function similar to this C code?

uint[28] values;
Get_Values(0, 0, 15, values);//get first part
Get_Values(0, 15, 13, &values[15]); //get second part of data

View 3 Replies

Get A Subset Of Unique Values In Column(1) Of A DataView?

Dec 16, 2009

Is there a way to get a subset of Unique values in column(1) of a DataView?

View 6 Replies

Select Subset From DataSet And Display In DataView?

Nov 3, 2009

I have populated a dataset from a text file and I can display it in a dataview. Can I and if so how do I, select a sub set from this dataset and display it in the dataview?

View 4 Replies

Why Isn't The Counter In For Loop Increasing Once For Each Found Subset

Nov 26, 2011

The program is to take an entered string then search for a subset of letters entered through and input box.In my subprocedure Sub btnSearch_Click I am using a loop to move through the entire length of an entered string to search for a set of letters entered through an input box. I can find the set of letters to search for but instead of increasing my counter "Found" for every instance of a match it returns the length of the string instead. I just don't know why the IF doesn't prevent the counter from increasing for every element in the string. I want the counter to increase only when the match is found. I just put 2 message boxes in there to make sure it found the right letter and then display the counter.

Here's the entire

' Name: Count Project
' Purpose: Displays the number of times a sequence of characters
' appears in a string.

[code]....

View 5 Replies

IDE :: Horizontal Slider Bars - Fit A Regression To A Subset Of Data

Jan 18, 2010

I have a set of x, eg 288, data values. The user wants to fit a regression to a subset of this data, eg (2 - 200), then she wants to analyse within a subset of this fitted range, eg at 20 and 100. So, on my form are four Hor. Slider Bars, to set the lower and upper bounds to the fitting and the analysis. The two that set the lower bounds work fine. The two that set the upper bounds are getting corrupted somehow outside of my code and I do not know how to solve this problem. What happens is that when I click on the right hand arrow on the slider bar, the program runs through my function with the correct values whilst the arrow is down, goes out of my code and then immediately comes back into my code, but with the wrong value set into the Hor. Slider Bar fields that I am working with, eg the .Value field. The new value is always 9 below the maximum that it can be, but I can see no connection to this number.

View 1 Replies

Io - Proper Way To Commit A Subset Of A Byte Buffer To File?

Dec 7, 2011

I am concerned that this code is copying bytes into a temporary buffer before writing directly to file.

I feel like there should be some method of copying bytes directly from the tail end of the main buffer directly to file.'this code copies all bytes starting at integer index from the main buffer into a new file: ga.exe

'declare temporary buffer
Dim EXEBytes(bytes.Count - index) As Byte
'copy subset of bytes over, starting at index
System.Buffer.BlockCopy(bytes, index, EXEBytes, 0, bytes.Count - index)
'write bytes from temporary array into file
File.WriteAllBytes(Server.MapPath("/BIN/ga.exe"), EXEBytes)

View 1 Replies

Returning Subset Of Dictionary With A Complex Type As A Key With Linq

Oct 5, 2010

I have a collection as follows

Private _bankRates As Dictionary(Of RateSourceBank.Key, RateSourceBank)

Where RateSourceBank.Key is simply

Public Class Key
Public RateType As String
Public EffectiveDate As DateTime

[Code].....

View 1 Replies

Create A .net Chart Object With A Series Based On A Data Subset?

Apr 8, 2012

I'm working in VS2010 on a visual basic application. It takes in serial port data, writes it to an access database, and then graphs the data.The data only comes in once every minute, so it's not like I'm building an oscilloscope. Right now, the chart is reading from the database using a table adapter and graphing just fine, so long as I keep the number of records in the database low.If I add too many records to the database, the chart shows a red "X" through it. I've played with changing the axes, but it is still a problem.I don't really need to graph the whole database.The twenty most recent records would suffice.How can I make a chart series with only a small subset of the database in it.Perhaps it cold be populated with a query?

View 1 Replies

Document.Elements("GradeProfile") Doest Not Return Elements With The Name Specified?

Jan 2, 2010

Dim Document = XDocument.Load(FileName)
Dim findElement = Document.Elements("GradeProfile")

[code]....

View 4 Replies

.net - Performing An Inner Join?

May 20, 2009

I've trying to do an inner join select statement where I select two fields from a table, and than all the records of a field in a second table that have the same id as the first table.The code looks as follow:

Dim conn As OleDbConnection
Dim cmd As OleDbCommand
Public Sub openDB()

[code]....

I get a an exception: "invalid bracketing of name [Vegetables Descriptions.DescID] if I take it out to make it look as follow I get a "Join expression not supported"

da = New OleDbDataAdapter("SELECT [Vegetables Descriptions.Task], [Vegetables Descriptions.Description], [TasksOcc.When] FROM [Vegetables Descriptions] INNER JOIN [TasksOcc] ON [DescID] = [DescID] WHERE [Vegetables Descriptions.VegeID] = vegeID", conn)

I tried folowing examples from the net but where unsuccessful.

View 3 Replies

C# - Performing An Audit Using Reflection?

Nov 11, 2010

I would like to perform an audit as part of a unit test that uses reflection to verify some assumptions, the basic-psuedo code for this would be as follows:

[Code]...

View 2 Replies

.net - Visual Studio 2008 Performing Like VBA?

Jun 30, 2011

I know about VSTO/VSTA, and I also know that some VBA functionality (with .NET syntax of course) can be done in .NET. There is definitely a learning curve going from VBA to .NET without VSTO. My question though is, can everything that is done in VBA somehow be recreated in .NET without VSTO?

The reason is because I am converting my VBA application into .NET for several reasons: I want to take advantage of OO, my class libraries will be better available for use, and for fun. I wouldn't be too happy if I got so far in only to learn of some limitations.

View 1 Replies

Performing An INSERT Statement From .NET To Access 97 DB?

Feb 4, 2011

I am writing a INSERT Statement which will INSERT data into a Access 97 DB.Everytime i run the Statement from my VB.NET Code i always get Error in INSERT SyntaxI have narrowed it down to one DB Field - INSERT INTO TEMP (Size) VALUES ('" & varSize & "') - I have taken all the other variable out.

Is the fieldname "Size" a reserved name or anything in Access 97 and is there a way round this so my whole statement will work including the Size part?

I have some old VB6 code which was written by someone else who is doing the same insert but instead of INSERT they have created a VB6 RecSet and set all the values then used RecSet.Update to insert the row of data. Is there a VB.NET version of RecSet and Update.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved