List Object Members And Values?
Jun 13, 2011I have a 3rd party object that gets passed to one of my methods. The object contains 20 or so string members. How can I easily list all of the string names and their values?
View 2 RepliesI have a 3rd party object that gets passed to one of my methods. The object contains 20 or so string members. How can I easily list all of the string names and their values?
View 2 RepliesSay I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 RepliesI have a problem with a generic list, which consists of intances of a class i created. I am just amazed, each time I add a new object to the list, it overwrites the previous entries. Here is a code sample, i just can't beleive it. I am using visual studio 2010:
Dim translations As List(Of TranslatedValue) = New List(Of TranslatedValue)
If Session("ctlTexts") Is Nothing Then
Dim reader As IDataReader = DataAccessFunctions.db.GetDataReader("SELECT [ControlID], [ControlTextEN], [ControlTextDE], [ControlTextBG] FROM [dbo].[tbLanguage]", GetConnectionString)
[code]....
I'm trying to change the data binding of a listbox when the value of a combo box changes.Here is the ComboBox change code - [code]...
View 1 RepliesI have an EggSac object which contains references to >100 000 Egg objects. Some variables in the Eggs have to be maintained to be consistent with EggSac, so I want to make these only changeable by EggSac. However EggSac passes references to its Eggs all over the application, so if I use public methods then any other code could modify the secure parts of the Eggs by accident.
What's a proper OO way to make sure only the EggSac object can call the "secure" methods of the Eggs, but still make the "safe" methods available to everyone?
My idea is to split Egg's class into a base class containing only safe methods and a derived class containing the secure methods that only EggSac should have access to. Then EggSac has members of the type of the derived class, but it casts them to their base class whenever something else wants one.
Im trying to search the entire active directory to look for a group and then see if the current logged on user is listed, then take an action based on that result.So far i have the below code which doesnt return the users who are members of the group MyTestGroup. Could anyone assist or guide me to see how i achieve this?
View 4 RepliesHow to list Enum's members in code? I have following Enum:
Public Enum TestEnum As int32
First = 0
Second = 2
Third = 4
Fourth = 6
End Enum
And I try to list all members of TestEnum via following code but it failed:
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
[Code].....
Need a list of Pcap.Net members or classes? Their website doesn't have much documentation and have looked around in the forums.
I have found..
PacketTs = Packet.Timestamp.ToString("yyyy-MM-dd hh:mm:ss.fff")
PacketS = Packet.Ethernet.IpV4.Source
PacketSp = Packet.Ethernet.IpV4.Transport.SourcePort
PacketD = Packet.Ethernet.IpV4.Destination
[Code]...
I have an application that reads data from a SQL query into a list corresponding to the rows of the query. So, I have something like this:[code]What I'd like to know is if I should be using a class (as above) or a structure, and what the difference may be in terms of memory or runtime, if any.
View 3 RepliesI have a number of arrays (lets say two for the time being, but this needs to be scalable from 1-n). Each array represents a different "parameter" for the application I'm working on. I need to create a multidimensional array containing a set which represents each of the permutations of each of the "parameters". Effectively each row represents each permutation of the selected options for each "parameter" array.
For instance, say the first array of inputs is:
"Blue"
"White"
"Yellow"
And the second:
1
66
95
I need to create an array:
"Blue", 1
"Blue", 66
"Blue", 95
"White", 1
"White", 66
"White", 95
"Yellow", 1
"Yellow", 66
"Yellow", 95
The main work is in the "If Not (OutputTemp Is Nothing)" loop. Effectively I need to access the content in the first array with a "modulus" so that: (using the example above). I'm accessing the rows in the following method
OldArr,NewArr
11
12
13
21
22
23
31
32
33
worked it out.
Here is the code.
Public Class Permutation
Public TitlePrimary As String
Public TitleSecondary As String
Public Order As Integer = 0
Public Values() As Object
[Code] .....
In C++ using std::list, this is a simple matter of erasing what an iterator is pointing to (the erase statement returns the next valid member of the list).What's the best way to iterator through a list and remove members that match a certain criteria?
View 4 RepliesI'm working on small project for my site... basicly we have over 600 memembers.. and every day new member registers as we can keep of track of all the new members we would like to do the following
By CLicking Button Importing members.php list in to our program so we can see all the new members that have registerd
This is good for our modirator so they can keep an eye out on new members
SO basicly
I click button and my program grabs my user list from my website and puts it in my list box ( but program will have to go to page 2 then 3 and so on and so on )
After reading all the examples for list of T exists and Find and find first, none show how to handle multi-property objects. Below is bare bones example maybe someone could flesh out to show how this should be done.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DatePriceList As New List(Of DateAndPrice)
DatePriceList.Add(New DateAndPrice(Date.Parse("1/1/2000"), 10.12))
DatePriceList.Add(New DateAndPrice(Date.Parse("1/2/2000"), 11.12))
[Code]...
ok this is annoying, i've got a structure RInteger.
Private VAR_Value As Integer
Private VAR_Max As Integer
Private VAR_Min As Integer
[code]......
Need to display the Gold, Silver, And Bronze members in a list box from a TXT file. Have problems isolation each group. When I run the program all of the name in the TXT file come into the list box.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim strMembers As String, objStreamReader As System.IO.StreamReader
[Code].....
Limited to using v2.0 of .Net framework (we use VB.net) due to environmental constraints on our servers.I've got an ASP.net webpage which pulls data from a webservice that performs checks on user accounts in active directory. Operators can check multiple accounts at one time using the web interface. The webservice returns a list(of AccountCheck) objects which themselves contain single properties like username, email address, and List(of AccountError) objects which contain multiple properties.[code]What I want to do is using some kind of repeater, create multiple panels or divs which contain labels showing the username, email etc, and a gridview which has the accounterror list bound to it to show all the errors. The users could be checking 2, 5, 7 accounts at once, and is dynamic.
View 2 RepliesI am working in VB.net and have a Class, Foo, that implements an interface, IBar.I have a List of Foo's, but I need to pass a list of IBar's into a function, but I keep getting casting errors, even when I use DirectCast.My code is [code]MainWorks works, but it would be really annoying and inefficient to have to do that everywhere I want to call this function.
View 4 RepliesI have an enumeration in the form[code]...
I would like to use these as values in a ComboBox, but I would like to display the strings "My Stuff" and "My Things" respectively.
I'm sure I've seen a method for quickly creating some kind of local object definition where I can assign a string property to be displayed, and a "MyCollections" type property to store the value of the enum element, but I can't for the life of me think of how to explain that to a search engine.
Suppose I have a list of Cat.
Public Class Cat
Public Property id As Guid
Public Property name As String
Public Property race As catRace
End Class
How can I quickly transform this List(Of Cat) into a List(Of Guid) using the id property?
I could do :
Dim newList As List(Of Guid)
For each item in catList
newList.Add(item.id)
Next
But I think there must be a way to do this faster (1 LOC). I just can't find how.
I'm having a problem with passing on values from my data grid view to a textbox located in another form.[code]
View 2 RepliesDoes link text mean I have to return a concrete implementation? Even though I am using svcutil with the /r that includes my entites(where IMyInterface is defined). I get no errors but it changes all List(of IMyInterface) to list(of Object) and I cannot deserialize it on the client
Error: list(of object) cannot be converted to list(of IMyInterface).
In VB.net, when I retrieve a value from a list do I get a copy of that value or a reference to it?
dim blah as someObject
dim listOfBlahs as list(of someObject)
listOfBlah.add(new someObject(1))
[Code]....
I need to be able to add elements to a copy of mylist.testlist without modifying the global mylist object. (Which seems to be happening via the below code.)When I am working on x, which should be a totally separate object, mylist is getting modified as well. How can I fix this? I have worked with lists extensively and never seen this behavior before. I have tested and reproduced the problem in .NET 3.5 and .NET 4.0 on Win 7 Pro 32bit.
Source Code:
Public Class Form1
Public mylist As New test
Sub Main()
[code]....
I would like to create list of child objects from list of parent object. Like If i have list of bookingroom which has one member room then i would like to create list of room from it.
eg. code:
Dim BookingRoomList As List(Of BookingRoom) = New List(Of BookingRoom)
Dim RoomList As List(Of Room) = New List(Of Room)
BookingRoomList = BookingRooms.FillGrid()
[Code]....
Is there any short cut method instead of iterating over for earch?
I am having a problem when setting VB.NET list object to another.I create an instance on ReadLocations and than create an object of ReadLocation where then I loop through ReadLocations and set ReadLocation1 equal to rl. What happens is that if I then go and change ReadLocation1 to something else (assdfhsd) it will also change the ReadLocations index. I am really confused why it would be doing that unless it is "=" sign means referencing instead of actually setting the value. Please help as I am a C# developer but the program I am modifying is in VB.NET.[code]
View 1 Replies[url]...base on the thread ive linked.
i am able to pass the checked value of the checked list box to a list box
my current problem is
i am going to save the values [ for instance mat_name ] on the listbox in the database
but i need the id [ for instance mat_id ] of that value
I have 2 classes
Public Class Shipper
Public Property ShipperID As Long
Public Property CreateDate As DateTime
[Code].....
How to know if a List(Of T) contains any control object without using a loop ?This doesn't work
Dim lstObject As New List(Of Object)
lstObject.Add("STRING")
lstObject.Add(2)
[code].....
I would like to ask what is the efficiency way the clean and dispose the object collected in the List (Of Object)?
Is that by calling the List.Clear() method will automatic clean all the object collected by it?
I am able to populate an object and output everything. How do I remove say the name2 object?
la.Remove(Logins("name2")) doesn't seem to work.
Private Sub btnListArray_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListArray.Click
[code]....