Working With Generic List Of String Array Objects
Apr 7, 2010
I'm writing a program that reads a directory of xml files (not well-formed), parses the xml, and dumps the data into an Excel Workbook.The file contents are similar in that they have many common xml nodes/attributes.Some files have additional nodes/attributes.The xml in these files represent configuration settings for a Web Application, one file per user.The expected output is a worksheet with a column for each node/attribute combination and a row of node/attribute values for each user.I'm just about finished with the program, but I've run into a bit of a snag.As the final step in the process, I need to loop through a generic list of array objects (that represent a user row) and send the array elements to Excel.I don't know the correct syntax to get the array objects out of the list and have been unable to find sample code specific to generic lists of array objects.[code]
View 3 Replies
ADVERTISEMENT
Mar 8, 2011
I have a generic List(Of Customer). The customer class has a name, address, and phone number properties. I also have a property of another class that accepts a customer name array. I am able to do this by doing the following:
Dim names As String()
Dim i As Integer = 0
'customer.GetCustomers is a List(of Customer)
[Code]....
Is there a better way to convert this to a string array?
View 1 Replies
May 3, 2012
i have issue returning a list in a web method. here is the code
<WebMethod()> _
Public Function getTags(para_parents As String) As List(Of getTypeDetailsByParentName_Result)()
Dim context As New PPEntities
[code]....
the error is
Value of type 'System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)'
View 1 Replies
Mar 14, 2009
so I have a generic list in a console application. Dim Channels as New List(Of Chatroom) Chatroom is a structure. But I have multiple classes, threads, and timers looping through this list, sometimes at the same time, but it always seems to raise errors because the number of items in the list gets changed while one of the other classes/threads/timers are looping through also. Is there any way to allow only one to manipulate it at a time?
View 8 Replies
Dec 16, 2010
I have a custom list that inherits Generic.List and it has a method for deselecting all of the members named DeselectAll It has looked like this for a few weeks and has worked fine.
Public Sub DeselectAll()
MyBase.ForEach(Function(p As Publipostable) p.ModeEnvoiChoisi = Nothing)
End Sub
Today, it stopped working ?!? I reverted to an earlier version using delegates and that works fine...
Public Sub DeselectAll()
MyBase.ForEach(AddressOf DeselectModeEnvoi)
End Sub
[code]....
Edit: Stopped Working meaning it no longer sets the property p.ModeEnvoiChoisi to Nothing on each item in the list. The DeselectAll method gets called, but all the items retain their previous values...
View 1 Replies
Nov 2, 2005
We are currently converting a larger legacy application from .Net1.1 to .Net2.0, both VB. Our new standard is Generic List, instead of arrays.We are recoding component by component. And while not everything is yet stored in generic.list we end up with compile time errors.Converting from generic.list to array is supported with myGenList.ToArray().But from array to generic list isnt that easy."Value of type '1-dimensional array of something' cannot be convertet to 'System.Collection.Generic.List(of something)"I know for sertain that the array consist of the type 'something', so an runtime exception converting is ok.Is there a good way to do the workaround untill the hole application is recoded?
View 1 Replies
May 21, 2010
I am trying to avoid every single function affecting my response time.therefore my question is using ToArray while converting generic list to array, does this take significant response time?should I use array directly while building my array within for each or working with list of and then at the endusing ToArray? any difference?
View 1 Replies
Sep 3, 2011
how to convert a list of int to byte array in C#, but can't get syntax to work out for me in vb.Converting a list of ints to a byte array.
View 1 Replies
Jul 29, 2011
I want the Function to accept List(Of String), Array & String and similarly return List(Of String), Array & String respectively. The Function simply adds a string (month) to the input collection. I just want to use it for string, array and list with needing to think of conversions.
[Code]...
View 2 Replies
Jan 28, 2012
I have the follow code in my program where I hit a SQLCe database to append the results into a list. That part works, but instead of exiting the function 'QueryDB' it goes to the else statement and runs the function again, which will return a null value. I designed it this way becuase I wanted to check to make sure the database is open before I try to execute the SQL statement, and if it's not open, call the method to open it and run through the function again.
[Code]...
View 1 Replies
Dec 1, 2009
I've created and populated a generic list of strings like this:
Dim MyList As New List(Of String)
MyList.Add("Beta")
MyList.Add("Echo")
[code]....
Now I want to order it.
View 1 Replies
Jun 8, 2009
I am a .net programmer vb & c# but i can't seem to figure out how to get my objects into a list or array in php. var mylist = new List<myobject>();
mylist.add(myobject1);
mylist.add(myobject2);
what i have tried. Products being a property for a collection of orderitems
$this->Products = getOrderItems();
public function getOrderItems()
{
$items = array();
[Code]...
View 3 Replies
Oct 19, 2011
I have an xml file with elements that look like this (abbreviated for clarity):
<post id="1" tags="tag1 tag2 tag3 tag4" />
I want to map this to the following class using Xml Deserialization, but I can't find a way to map the tags attribute to an actual List(Of String).
<Serializable()> _
<XmlRootAttribute("post")> _
Public Class Post
[Code]....
Is there any way to override the default Deserialization?
View 2 Replies
Aug 26, 2011
I was wondering how I could go about getting a list of string from a list of objects, while removing duplicates[code]....
View 2 Replies
Nov 2, 2011
I am running into a simple issue for which I cannot find an effective solution.
I need to convert 2 D array of objects to 1D String.
Dim saRet(,) As Object = Nothing Dim fileLineArray() As String = Nothing
SaRet = xlrange.Value //it gets values assigned as objects
In a loop....
fileLineArray(i) = Cstr(SaRet(i,0))
I get the error, index was out of bound. ToString isnt able to convert 2d array of objects to 1 D.
View 1 Replies
Apr 27, 2012
I figure I should use 'Aggregate' but apparently I am getting it wrong First I get a list of my Entity objects Dim employers As List(Of myEntity) = (New XXXX()).getZZZ(userName, userType) Then I figured this would be a way to put all the names in a string Dim names as String = employers.Aggregate(Function(current, [next]) current.Name & " " & [next].Name)
[Code]....
View 2 Replies
Mar 23, 2012
I want to pass a List of T where T is an object I've created that has about ten properties (strings, dates and integers).The lst passes to the function successfully. I am also passing an New T of the Object (itm as T).I can see all the values (see image below), but because it's generic I cannot seem to retrieve the property values and I cannot figure out how to iterate through the properties of each itm as they are retrieved in the For Each.[code]
View 10 Replies
Jun 30, 2011
I am trying to create a list of a generic type in vb.net 2.0 framework.
This is the generic type definition:
Public Class GenericParamMap(Of T)
Public Sub New(ByVal pParamName As String, ByVal pPropValue As T)
mParamName = pParamName
[Code]....
The compiler does not allow a "T" in the method's parameter because it's not defined, but I'm not sure how or where to define it. I thought it was okay to have a generic method definition.
View 2 Replies
Jul 9, 2011
I have started researching Reactive extensions and I would like to know how to do the following (ill try and keep it simple):
1) have a list of string (or any other type)
2) when an item is added to the said list, do something with it...
Guess im just kinda stuck where to start :/
View 3 Replies
Aug 17, 2010
I have found a lot of examples of this kind of thing on the web but cannot get one that works - basically i am serializing to a byte array and want to store it in a string i have tried all of the System.Text.** (ASCIIEncoding,UTF32Encoding,UTF7Encoding and UTF8Encoding) in the following way:
[Code]...
View 11 Replies
Dec 12, 2010
I am using VB.NET and I can't compare the radio button lists selectedItem.Value to a string, it doesn't work...here is the code: (I have also tried selectedValue it does not work either)
[Code]...
Why won't it evaluate that rblOne.SelectedItem.Value = "No" !?!?!? I tried rblOne.SelectedValue, that doesn't work, AND I added .ToString to both, which did not help, I even tried it w/ "No".ToString...this doesn't make any sense.
View 1 Replies
Oct 1, 2009
I'm looping all the properties in an object via reflection:
For Each p As PropertyInfo In values.[GetType]().GetProperties()
If p.CanRead Then
'Do stuff
End If
Next
how to determine whether the property in question is a generic List(Of T)? If it is I need to loop the list itself.
I've experimented with GetType and TypeOf but have not managed to get anything working.
To clarify, I want to keep this generic. I do not want to specify the type of T, I need to loop the list items and call the ToString method on each item. T could be one of a number of different types (application specific reference types). Is it possible to do this without specifying types?
(VB.NET 2005 with .Net 2.0)
View 3 Replies
Mar 23, 2011
Public Class notifierMain
Public Class Contacts
Inherits List(Of row)
Public Sub New()
[code]....
When I debug this winforms application I get curType = "notifier.notifierMain+Contacts+row" I want to the Validate function to know it is in MyContacts. How do I do this?
View 3 Replies
Apr 7, 2011
it seems always at this time I cant figure out how to do something maybe it has something to do with lunchtime.
Im having trouble using a method that is defined by an outside company
This is a link to their integration guide:
[URL]
This is their documentation for the class Im trying to use
OrderQueryWebService Class
This class is for SID in particular and is made for use with the notification methods. This is for the Order Query Web Service specifically, allowing clients to return the status of transactions for their merchant, whenever they want to.
Methods
/ <summary>
/ Pass through the variables required and receive a list of Transaction
objects showing transaction status
[Code].....
The MerchantCode, the MerchantUsername, the MerchantPassword are all good the List is a custom type called SetComHash.Transaction
Everytime I try adding a string to the list such as the transactionNumber and some other values it gives me a type error:
"Value of type string cannot be converted to 'SetcomHash.Transaction'
View 13 Replies
Apr 15, 2012
I am trying to get each item in a list box into a string array. However, I keep getting an index error and I am not sure why. I am doing this so i can perform a LINQ on the array.
Error:InvalidArgument=Value of '16' is not valid for 'index'.Parameter name: index
[code]...
View 1 Replies
Sep 9, 2010
I want to reading in a excel file and extract the sCodenumber sDescription ans the sStatus and store them in a array : StatusComposeArray(5200) As MyCompose. After this I need this array for comparing outside this class. But as can you see the array is defined inside the sub: ReadingIn_ExcelFilesCompose [Code]
View 2 Replies
Oct 26, 2009
I want to convert a List (of Long) into a string array.
Reason: it's a list of database IDs and I want to make a comma delimited string to pass into a stored proc.I tried this:
Dim commaDelimitedList As String = String.Join(",", itemIDList.Cast(Of String)().ToArray)
but I'm clearly not using the Cast correctly since it throws an exception:
System.InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.String'..
Is there a way to get Cast working for this, or am I stuck with ConvertAll and a delegate function?
View 3 Replies
Jun 12, 2009
I'm having difficulty passing a variables in a an array list. [Code] I have to pass the paramvals array to the function. The paramvals array contains the string but not the value of variable of that name. For example, parmaval(0) should contain the value of vSequence but it showing me that it contains string "vsequence".
View 3 Replies
Jan 18, 2012
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using conn As New SqlConnection("Database=Clinic_Management_System;Data Source=.SQLExpress;Integrated Security=True;AttachDBFilename=|DataDirectory|Clinic Management System.mdf")
Dim cmdRecord As SqlCommand
[code]....
View 2 Replies
Aug 28, 2009
I'm using String.Join to attempt to turn an array list into a string that is comma separated, such as "1,2,3,4". I can't seem to get the syntax working.
Here's what I'm trying:
Dim aryTest As New ArrayList()
aryTest.Add("1")
aryTest.Add("2")
aryTest.Add("3")
[CODE]...
How can I go about doing this properly?
View 3 Replies