VS 2010 Using .Contains On A List(of Custom)?

Mar 31, 2012

I have made a custom structure which I have in a list.Dim AllUsers As New List(of mUsers)Structure mUsers Dim mName As String Dim mMadeDate As Date Dim mActivated As BooleanEnd Structure I have populated the list, but now I would like to be able to search it, and to check if something exists inside of it. For example, I would like to check if.If AllUsers.mName.Contains("John Doe") = True Then MsgBox "User John Doe Exists!"

I know if this was simply a List (of String) then .Contains("John Doe") would work. But I cannot figure out how to have it look through the contents of that custom type in the list(of.

View 3 Replies


ADVERTISEMENT

VS 2010 Custom Type Array / List With Adding Items And Specifying Custom Type Variable

Jun 21, 2011

I recently downloaded VB 2010 Express so i am quite new to the language, but i have worked with dark basic, which seems to b very similar.Anyway, my problem is that i cannot seem to correctly set out my array of a custom type/class. i am trying to create two arrays, one of available entities and another of selected entities of which the user selects the entities to be dealt with in irrelevant ways. i have creates a button (called test) which adds some entities to the available list and all the entities come back the same value but they shouldnt be as you'll c in the code. i have run the step into command a found that "available.item(#).Name = " will change all of the entity's names.As of current i am working with lists as the array kept asking for a 'new' statement but i couldnt figure out where to put it.[code]

View 7 Replies

VS 2010 Custom Query Against List<string>

Aug 15, 2011

I have a List<string> that contains paths, such as:

[Code]...

Given a given root, such as Root, I would like to "query" this list to return only the first level values, such as:

[Code]...

View 2 Replies

VS 2010 Clickable List Of Custom Colours Linked To Text File?

Aug 21, 2011

I would like to create a little list in my Windows Form showing a list of custom colors with their 'friendly names'. Technically it can be anything (ListBox, ListView, Panel etc... whatever).

I simply want it to look something like this:

I would like to store data for this list in a simple TXT file in such form:

Quote:

Blue,Blue
Red,Red
#F6A118,My favourite color
#004080,Another color

And of course I would like each element on such list to be clickable, so if I'd click 'My favourite color' it should return the color's HEX value (#F6A118).

View 21 Replies

Pass Generic List To A Function That Has A Custom Defined List

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

Vb.net - Convert From Custom List To List Of String

Mar 25, 2010

I have the following code:

[code]...

The intention is to convert an IList of custom objects to a string equivalent comprising each element in the Ilist. Unfortunately I can't seem to find a way to get the underlying data of the custom object, and of course as in the above example, using object simply gives me a string of types definitions, rather than access to the underlying data.

View 2 Replies

Get Custom Properties For A Custom Control Into The Visual Studio Properties List?

Nov 25, 2009

What I've done is create a User Control Library (Project) and I've added a single User Control to that project. The control contains a single FlowLayoutPanel, and I created a Property on the control itself to pass the FlowDirection from the Control to its FlowLayoutPanel child.

Build, reference, component appears in the Toolbox and everything works fine, but the property on the control does not appear in the Properties window when I go to edit it at design time.

View 6 Replies

Multithreading - Create Custom Objects/list Of Custom Objects In .NET?

Jan 24, 2010

I need two seperate lists, which every item is Integer, String, Bitmap - and one which every item is Integer, String String. However I don't know how to do this, or even where to look - I've googled for custom objects and custom object lists. What I'm trying to do is this.Custom Object1 is Integer, String, Bitmap Custom Object2 is Integer, String, String

In one thread I'll be adding items to List1(Of Object1), and processing them, and adding the results to List2(Of Object2), however I need to be able from other threads to look at the list and say only give me the items where Integer = (my thread ID), is this possible? Any help, or even links to information that would be relevant to this request would be helpful?

View 2 Replies

List Of New Custom Object?

Sep 2, 2010

I created a simple (for now) custom object:

VB
Public Class Form1
Dim AllPartFiles As List(Of Part)

[code]....

As I search a folder for files, it returns FilePath as a string for each file in the folder, then assigns a new Part.FullFilePath to the current returned FilePath, then add the Part to AllPartFiles list. So I can retrieve each Part from AllPartFiles later. But everything I try doesnt work.I know below is wrong, but might show what Im trying to do:

VB
Dim Files() As String
Files = System.IO.Directory.GetFiles(RootFolder, "*.ipt")
Dim k As String

[code]....

Create a New Part, change its values, and then add it to AllPartFiles list for later, then repeat?

View 12 Replies

List(of T) Custom Sorts In VB

Oct 13, 2011

Im converting a winforms application and it has gone smoothly except for trying to get custom sorts for generic lists working.

VS 2010 ASP.net 4.0

I have my classes in App_code but it fails to work like the winforms version.

Dim ReturnList as List(of Quotedata)
ReturnList.Sort(New SortQuoteDateAscending)
> Unable to cast object of type 'SortQuoteDateAscending' to type 'System.Collections.Generic.IComparer`1[Quotedata]

Is there a gotcha with asp.net implemenation of custom sorts in asp.net 4.0 or am I missing something.

Public Class Quotedata
Private m_quotedate As Date
Public Property QuoteDate() As Date

[Code]....

View 3 Replies

Searching The Custom List?

Feb 12, 2010

I want to use a System.Collections.Generic.List<Of T> and store custom objects in the list. I then want to filter the list by my own custom defined criteria and return a System.Collections.Generic.List<Of T> of all the objects in the list matching my search criteria. For searching in Java, you would create an object that implements the comparator interface. The object would then be passed as an argument to the list's sort method. Is there an equivalent VB way to do this BUT when searching for items in the list?I have looked at using delegate functions, but these pass EVERY item of the collection into the function, which is not efficient in any way.

View 12 Replies

Add Custom Class To A Generic List?

May 10, 2010

I created two classes. One class is StudentClass and the other is HomeroomClass. The HomeroomClass contains a readonly property as a generic list of the StudentClass. [code]...

View 6 Replies

Custom Chart Types To List Box?

Nov 14, 2009

Is it possible to add Excel Custom Chart Type names to a list box at run time? That is, Microsoft.Office.Interop.Excel.Chart.XLChartType values to a list box?

View 1 Replies

List(of Object) With Custom Add Action?

Dec 5, 2011

Looking to have a list(Of object) where i can make my own Add method, so i can do some stuff to an item when added

Is that possible at all, been looking at the net and haven't found anything.

View 5 Replies

Accessing Objects From Within A Custom Object List

Mar 3, 2009

OK - for starters - I'm not even sure that the title of this thread accurately describes what I want to do - but I had trouble verbalizing it. So I will give this a try: In my application, I have a custom object, call it myObject. In addition, I have another custom object called myObjectList which is basically a List(Of myObject).

Up until this point, all of the functions that I have been working with in my BLL and DAL have been shared - I haven't needed a specific instance of my object thus far. I currently need to write a function that finds a particular myObject within myObjectList and returns to me myObject. I know that the List(Of T) has a find method, but from what I have read so far - I don't think it is what I want (doesn't it return true or false? -and also, do I need an existing object to pass to it to see if it is in the list?)

[Code]...

View 5 Replies

Comments - Custom TODO: List On An Interface

May 21, 2010

How do I add my own todo and comments list to appear on Interfaces? I want it to pop up like IDisposable does:

[Code]...

View 1 Replies

Create Custom MessageBox With List Of Options?

Oct 15, 2009

I want to create my own custom MessageBox.
The default message box from VB contains a few options (as a parameter) like:
MessageBoxButtons.OK
MessageBoxButtons.RetryCancel
MessageBoxButtons.YesNo
MessageBoxButtons.OKCancel
etc...
How can I create a sub that also has a list of options the user can choose from??

View 3 Replies

Custom Control - Specifying Items To Be Added To List

Sep 30, 2009

I've created a custom control that I insert into my window with the following code
Code:
<controls:ListExpander Text="Class Diagrams"></controls:ListExpander>
The control in question contains several subcontrols, among others, a list. How can create the setup, so I can specify items that should be added to the list?

Code:
<controls:ListExpander Text="Class Diagrams">
<SomeItem>data<SomeItem>
<SomeItem>data<SomeItem>
<SomeItem>data<SomeItem>
<SomeItem>data<SomeItem>
</controls:ListExpander>

In which case the SomeItem objects should be added to the list in the ListExpander:
Code:
<ListBox Name="lstItems" Background="LightGray">
<ListBox.Items>
// Items should go here
</ListBox.Items>
</ListBox>
I'm quite new to WPF, but I suppose it's something along the lines of creating a dependency collection on ListExpander that takes object of the type SomeItem? I simply want to be able to give the control a few arguments which it can translate into items in the listbox contained within the the control.

View 4 Replies

Custom List / DGV For Auto-wrapping Columns

Dec 19, 2009

I attached a screenshot of my IRIS program and am wanting to implement a new feature, but I'm not sure how to do it. On the left hand side, you can see I have a bound datagridview control that displays a device name and an IP Address from a table in a database.What I want to do is have the option to launch a new form that has ALL the devices visible (including their state: green or red) and based on the size of the form, be able to auto-wrap to a new column.[code]So basically, instead of being able to only see the devices in the DGV on the left as it is scanning, I want to be able to see ALL of the devices in multiple columns in a new form. I looked on codeproject for a custom control to do this, but didn't really find anything.

View 5 Replies

Possible To Use Generics To Populate List With Custom Classes?

Jul 10, 2009

I have several different lists I want to call. They all have the same format for the class:
id, value, description, order.
Instead of creating a bunch a classes to return the all of the many lists, I wanted to use generics and just tell it what kind of list to return. However, I can not figure out how to populate the classes.

Here are 2 examples of function in my calling code. This should indicate the type of list and the stored proc used to get the data:
Public Function getTheEyeColors()
Dim glEyeColors As New GenericList
Return glEyeColors.GetALList(Of EyeColor)("GetAllEyeColors")
End Function
[Code] .....

View 4 Replies

Search A List(of T) Where T Is A Custom Data Class?

Oct 17, 2011

I think my question is a little more complicated than I can fit in the title. Say I have a data class for contacts:

Public Class Contact
Public Property Name As String
Public Property Phone As String

[Code].....

I have a List(Of Contact) object with several different contacts. How would I search the List for the contents of one of the properties and return the resulting Contact object?

View 1 Replies

Asp.net - .NET User/server Control With Custom List Items?

Feb 18, 2011

I'm attempting to create a simple menu user control just as outlined here. The attached code results in an "Object reference not set to an instance of an object" error, but I can't figure out why.

<%@ Master Language="VB" CodeFile="MySite.master.vb" Inherits="MySite" %>
<%@ Register src="Controls/Menu.ascx" tagname="Menu" tagprefix="my" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

[Code]...

View 1 Replies

Bind A List Of Custom Objects To A Listbox Control?

Jun 25, 2010

vs2010 vb.net WPF project

This is an experiment to learn something.

I have a class called logitem

it has a datetime property, and a message as string property

I have declared myLogEntries as List(of logItem)

I have a ListBox.

Ok now what?

I have searched but i am getting lost in all the examples.

I have set the ItemsSource=myLogEntries

I think i need a datatemplate or maybe to specify binding source.

I am doing all this in the wpf form loaded event.

I guess i need a sample code for binding a list of collection to a listbox.

View 5 Replies

Bound To A List Object Of A Custom Type Via A BindingSource?

Nov 11, 2010

I have a datagridview that is bound to a list object of a custom type via a BindingSource. From everything I've read, I should be able to click the column headers and the rows sort, This doesn't happen for me. Sortmode is set to automatic and the column headers aren't set to be used for selection so it should work.

I know that I could sort progamatticly but that seems a little bit of a waste given that I should just be able to do it by default.

View 2 Replies

Copying Elements From List Where Frequency Is Custom Class

Sep 21, 2010

I'm trying to copy the elements from a List(Of Frequency) where Frequency is a custom class I have made. Everything in the other places seems alright but the problem seems to be with the copying, where it still references the original table, so changing the values of one changes the original. I've tried the List.CopyTo() method and tried converting to and array with List.ToArray and then using Array.Copy but it seems they always change the original. I've also tried a for loop and create and New instance of the classes but that doesn't work either. What I'm using it for is to pass the List(Of Frequency) to a new Task to do multitasking(), if anyone can think of a better method to pass a List(Of Frequency), or an array to to a task and have it not change the original.

View 3 Replies

Custom Event - Invocation List Implementation Considerations

Apr 9, 2010

I'm looking for some pointers on implementing Custom Events in VB.NET (Visual Studio 2008, .NET 3.5). I know that "regular" (non-custom) Events are actually Delegates, so I was thinking of using Delegates when implementing a Custom Event. On the other hand, Andrew Troelsen's "Pro VB 2008 and the .NET 3.5 Platform" book uses Collection types in all his Custom Events examples, and Microsoft's sample codes match that line of thought. So my question is: what considerations should I have when choosing one design over the other? What are the pros and cons for each design? Which of these resembles the inner-implementation of "regular" events?

Below is a sample code demonstrating the two designs.
Public Class SomeClass
Private _SomeEventListeners As EventHandler
Public Custom Event SomeEvent As EventHandler
AddHandler(ByVal value As EventHandler)
_SomeEventListeners = [Delegate].Combine(_SomeEventListeners, value)
[Code] .....

View 2 Replies

Get Notified When List Of Custom Type Property Changed?

Mar 2, 2011

I have a class and one of the properties is a list of a custom class. The caller gets the list and is adding instances of class to the list. How do I get notified that the list has been updated?

Private _list as List(of MyType)
Private _totalField1 as Integer
Public Property MyTypeList As List(Of MyType)
Get
Return _list
End Get
Set(ByVal value As List(Of MyType))
_list= value
_totalField1 = _list.Sum(Function(x) x.Field1)
End Set
End Property

What I'm trying to do is every time a MyType object is added to the list keep a running total of Field1, but adding to the list doesn't use the setter. How can I know when the list has been added or changed?

View 1 Replies

Sorting A List Based On An ArrayList Within A Custom Object

May 24, 2010

I am using a list to keep track of a number of custom Row objects as follows:

Public Rows As List(Of Row)()
Row has 2 properties, Key (a String) and Cells (an ArrayList).

I need to be able to sort each Row within Rows based on a developer defined index of the Cells ArrayList.

So for example based on the following Rows

Row1.Cells = ("b", "12")
Row2.Cells = ("a", "23")

Rows.Sort(0) would result in Row2 being first in the Rows list. What would be the best way of going about implementing this?

View 2 Replies

VS 2008 - Custom Control 'Serializable' - Contains A List(Of Panel)

Nov 29, 2010

I'm trying to create a custom control that contains a List(Of Panel). I quickly ran into an error about the base class Panel being nonserializable. So I created my own class that inherits from Panel and implemented the ISerializable interface. At the surface, everything appears to work, at least everything at design time. I don't know what would happen if I tried to run the application. Anyway, the errors occur when I try to open a file that contains my custom control. For example, I create a new Windows Form and add my custom control to it. I save the Form and close it.

Then I try to open the form and get the following error: Object of type 'MyTestApplication.SerializablePanel[]' cannot be converted to type 'MyTestApplication.SerializablePanel[]'.

I don't know what I'm doing wrong? I've opened the XML file to see what it's actually writing, and read the header notes about using binary base64 serialization. I think that's what I'm using, but I'm not sure.

Below is the code for the class SerializablePanel:

Imports System.Runtime.Serialization
Imports System.ComponentModel

<Serializable()> _

[CODE]...

View 5 Replies

Adding Font Styles To Drop Down List With Custom Message Using Asp.net?

Oct 25, 2011

I have a drop down list with font names and I would like to display them with their styles and not names and giving that style to a custom message as shown below This is actually what I need it.How do I acheive this?

Here is how I am loading fonts from my system

For Each f As System.Drawing.FontFamily In System.Drawing.FontFamily.Families
DropFont.Items.Add(f.Name)
Next

View 1 Replies







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