Specify An Inline Array To Custom Attribute?

Oct 4, 2010

I would like to know if there's any way to specify an inline array (lets say of strings) to custom attribute on a property in vb.net.

I have the following example that doesn't compile in vb.net (.net 1.1):

Attributes.ManyToOne(New String() {"a", "b", "c"})> _
Public Property PaymentTerms() As PaymentTerms

[Code]....

I get compiler error when I feed the array to the custom attribute in vb.net. I have no problem in C#, just vb.net. What is the correct syntax in this silly language?

View 1 Replies


ADVERTISEMENT

Add An Array Sort Inline?

May 6, 2012

strtest() = objFile.ReadToEnd.Trim.Replace(vbCr, "").Split(vbLf).Distinct.ToArray

I created this command from a few examples which reads the text from a StreamReader, Trims, splits on EoL, and returns a unique list. My next command is a sort. I couldnt figure out how to add a sort to this command. Its really not that important but I was curious if there�s an easy way.

Additionally if there's a better way to take a text file into an array or collection I'm all ears.

View 10 Replies

.NET Custom Property Attribute?

Mar 6, 2010

How can I shift the GET-implementation of a Class property to a / using a custom attribute? (I've added instantation vars (classname, propertyname) to the attribute, however I'd rather have these automatically fetched ofcourse.)

Public Class CustomClass
<CustomAttributeClass(ClassName:="CustomClass", PropertyName = "SomeProperty")> _
Public Property SomeProperty() as String
Get() as String

[code]....

View 3 Replies

Color Property On Custom Attribute?

Aug 4, 2010

i wrote a custom attribute and got the following Color property that I want the user to be able to indicate the color property in the attribute on a class:

Private _ColumnColor As System.Drawing.Color
Public Property ColumnColor() As System.Drawing.Color
Get

[Code]....

View 1 Replies

Retrieve Custom Attribute For Asp.net Checkbox?

Dec 8, 2011

I am using a repeater with the Item Template of a checkbox. Here's my checkbox template:

[Code]...

Now, I know asp checkboxes do not have a value attribute, but I read somewhere that you can put that in there and it will work the same. I'll have to look it up again to see if I read it wrong. However, just in case it is possible to put the custom attribute in there, how do I retrieve it in code behind? I looked at the source after the page is created and there is no attribute in the control that says "value".

View 1 Replies

.net - Custom Attribute Parameter Of System.Type?

Feb 19, 2012

I'd like to auto-register the common/simple services in my unity container. I think the cleanest way to do this would be via a custom atribute.I can then examine all the (abstract) classes in an assembly and register those types with unity.The piece of information I'm missing is the interface(s) that the class wants to be registered against

eg:

Public Class AutoRegisterAttribute
Public Property ForInterface As System.Type
Public Sub New(ForInterface As System.Type)

[code]....

Note, I don't just want to find any class it implements as shown with IDisposableI've tried doing this using generics (generics can't inherit from Attribute), with a Type Parameter (Passing in IEngine.GetType results in a "Constant expression is required")

View 2 Replies

Add A Custom Web.config Attribute To A Pre-existing Element?

Jan 4, 2012

I have created Custom .NET controls, and I'd like to know if it's possible, how to add a custom attribute in the web.config when you add the reference to the control.

Currently it is:
<controls>
<add tagPrefix="FOO" src="~/Controls/FooControl.ascx" tagName="Bar" />

[code].....

View 2 Replies

Add A Design-time Attribute To A Custom Control?

Jul 29, 2009

setting the default value for an integer attribute of a custom control seems to have stopped working. The following code adds the Maximum attribute to the design-time properties table, but the default value pops up as 0, not 99:

<System.ComponentModel.Browsable(True)> _
<System.ComponentModel.Category("Behavior")> _
<System.ComponentModel.Description("highest value possible")> _

[Code].....

View 4 Replies

VS 2008 - Retrieve Enum Custom Attribute In Single Statement

Jan 28, 2010

I have an enum set with custom attributes. need to retrieve the attribute value in single statement ...

Public Enum Messages
''' <summary>
''' <value>(MessageText : Do you want to save ?)</value>
''' </summary>
<StringValue("Do you want to save ?")> Save
[Code] .....

Now I needed to retrieve the enum value like something below.
Messages.Save.GetType().GetCustomAttributes...... something is possible in single statement itself?

View 1 Replies

VS 2010 : Copy This Array To A Temp Array So That The Temp Array Has All The Same Values As The Original Custom Array?

Jun 19, 2011

I have an array of people stored in a custom structure array... how can i copy this array to a temp array so that the temp array has all the same values as the original custom array?

View 4 Replies

Reading 'object-attribute-attribute Value' Triples From Column-based CSV Files

Nov 27, 2011

here any algorithms/pseudocode for reading/parsing 3-column csv data and determining unique objects/attributes/values?

example data:

john,height,1.75
george,age,21

[Code]....

i have already implemented a solution of my own but it's too slow and i can't find any relevant literature on the internet.

View 6 Replies

Unrecognized Attribute 'targetFramework Note That Attribute Names Are Case-sensitive?

Nov 10, 2011

Possible Duplicate: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive

I am using window xp and iis 5.1 to run the application.

error is occurred Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

[Code]...

View 2 Replies

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

'SSLAccessFiltercannot' Be Used As Attribute Because It Does Not Inherit From 'System.Attribute'

Feb 2, 2012

I get an error when I try to build my project.'SSLAccessFiltercannot' be used as an attribute because it does not inherit from 'System.Attribute'. [code]

View 1 Replies

Open Html File And Fill Html Tag And Attribute In Vb Array With Explan?

Aug 19, 2010

then fill all tags and attribute of this page in vb arrayi know this is too much but would you expl

View 4 Replies

Create A Custom Class That Has Inside An Array Of Another Custom Class?

Jan 31, 2011

I want to create a custom class that has inside an array of another custom class (see my code below) but when the programm runs is crashes. Why? What is the right expression???? Plz help I'm a newbie in VB.net.....

Public Class ctrarray
Public nameclass As String
Public ctrlindex(glvar_spaces) As ctrlindexclass
End Class

[code]....

View 6 Replies

Open Html File And Fill Html Tag And Attribute In Vb Array?

Aug 21, 2010

i want open html file in vb

then fill all tags and attribute of this page in vb array

View 3 Replies

.net - VB Datagrid + Array With Custom Class?

May 14, 2012

I have created a class "student" and made an array which contains students.I would not only like to display the array in a datagridview, but the array should also be updated if the user makes changes to one of the students in the datagridview.

I succeeded in showing the array in the dgv: one way is using datasource prop, the other is doing is diagrammatically. However, i can't find out how to let the user edit the array by editing the dgv.

View 1 Replies

Custom Class As An Array Of Properties?

Sep 30, 2009

I'm moving my first steps in the VB.NET world (I come from VB6) and I'm stuck with the creation of a particular class.

Let's say we have a bus that always has 101 places. I'm trying to create a class containing the map of the bus, along with methods to graphically represent it.

My "Bus" class will have a couple of properties ("BusColor", "BusModel") related to the whole bus. Then it should have a property called "Places" whose type is a custom class thet represents every single place, along with, for example, the passenger name or the place number. This property should of course be an array.

This is my code so far (simplified):

Public Class BusMap
Private Const MAX_PLACES As Integer = 101
Private _BusModel As String = ""

[Code]....

but I wonder if there is a more standard way of doing this.

My second question is: how can I modify my class to be able to iterate its Places property with the "for each" statement? A quick search on the web showed up that I should implement the IEnumerable interface, but I'm still not enough confident with the concept of Interfaces.

View 6 Replies

Dynamic Array Of Custom Class

Jun 16, 2009

I've been programming in VB.net for a while off and on, but never really had a need to use custom classes till now.I built a function in a module to populate a class, The class how ever is supposed to refer to one instance.I need to create an array of this class but the amount of instances needed is not always known.Works fine till the class goes to populate the class array.[code]It's probably something simple, I've just starred at it to long. Keep gettitng "Object reference not set to an instance of an object."

View 1 Replies

Persisting An Array Of Data Using A Custom Control

Oct 12, 2011

Does anybody know how to persist (save and recall) a structure array when using a custom control? I don't want this data to show up in the properties window but it needs to be available "behind the scenes".

Right now, I'm writing the information to a file but this causes portability problems and may trigger the UAC.

[code]...

How can I persist this without writing to a file? Should I save it to the registry?

View 3 Replies

VS 2005 - Creating Array Of Custom Controls?

Nov 6, 2009

I am creating an array of customer controls by doing the following:
Dim CtlLosArray(150) As Control

Then I'm setting up the first control in the array like this:
CtlLosArray(1) = New ShieldLOSInfobox
CtlLosArray(1).Location = New Point(0, 0)
CtlLosArray(1).Visible = True
CtlLosArray(1).Show()
CtlLosArray(1).Name = "Label1"
Me.pnlLOS.Controls.Add(CtlLosArray(1))

Now on this custom control I have a panel and a few text boxes and as you can see I may be adding about 150 of these custom controls. What I am wanting to do is to be able to access that control then the item on that control based on the array. Something like the following:
CtlLosArray(1).Controls.Item(Panel1).backcolor = Color.Yellow
But the above does not work. How I can access a specific item on the customer control within the array?

View 2 Replies

VS 2010 - DataGrid Custom Class Array

May 14, 2012

I am working on a project which lets the user edit the students in a certain group using a datagrid. First I created a class called student and then I created a student-array. Displaying the students in a datagrid works fine. On form-load, I change the datagridview.datasource to the student-array. The datagrid has 20 rows by default (Public dbstudebt(0 To 19) As student). When I edit an existing student everything works fine but when I fill something in in an empty cell and press enter or tab to confirm and add a new student, it just clears the cell and nothing happens. So basically, editing existing studs in the datagrid works fine, making new student doesn't work at all as those cells are always cleared immediately.

View 4 Replies

VS 2010 DataGridView - Array - Custom DataType?

Dec 20, 2010

I have a large text file that I am going to be parsing. Each line can contain a variety of Specific Variables.

[Code]...

View 4 Replies

Inline Debugging In ASP.NET VB?

Nov 4, 2009

i have an VB.NET application with few functions i need to debug (like ie. Assert in C#). Is it possible and how i do that ?

Public Shared Function createNumberArrayList(ByVal startValue As Integer, _
ByVal endValue As Integer, _
Optional ByVal isBackwards As Boolean = False) As ArrayList

[Code].....

Basically what i need is to enter few values and see if the function works and returns proper ArrayList.

View 1 Replies

Create A Custom 2 Dimensional Array Datastructure/class?

Jun 21, 2010

I want to create a user defined data structure, which will be a 2 dimensional array such that each individual square of this 2-dimensional array will also store the score and the grades. ( Iam using VB.NET) More details:

for example: There is an 2 dimensional array with 3 columns and 2 rows, I want to fill each of the

(0,0);(0,1);(0,2) with their own score (Integer type) and grades (String Type).

And this is same for the rest of the squares i.e. (1,0);(1,1);(1,2) and (2,0);(2,1);(2,2)

After creating such custom data structure: "CustomArray", I should be able to create the instance of this custom data structure (which will be a class) and code something like this:

Dim objCustomArray as CustomArray
objCustomArray = New CustomArray
for i as Integer =0 to 3

[code]....

View 2 Replies

Create Custom 2 Dimensional Array Data Structure?

Feb 20, 2010

I want to create a user defined data structure, which will be a 2 dimensional array such that each individual square of this 2-dimensional array will also store the score and the grades. ( Iam using VB.NET)
More details: for example: There is an 2 dimensional array with 3 columns and 2 rows, I want to fill each of the

[Code]...

View 2 Replies

Custom Class With A Public Property String Array?

Jan 5, 2010

I am trying to create a property of type string array (if this is possible).....and I seem to be lost.

I tried the following, but it says "String cannot be converted to '1-dimensional array of string'" at the return

Private _strZipList As String()
Public Property strZipList(ByVal i As Integer) As String()
Get

[Code].....

View 10 Replies

Equivalent Of Following Inline Function In C#

Jun 22, 2010

Tell vb.net equivalent of following method:

CODE:

Which on build in visual studio 2005 gives an error.

View 2 Replies

Inline Calculator For A Textbox?

Sep 16, 2010

I need a inline calculator for a textbox.

When the user types 45*10+5 i need to have the answer displayed as 455 in the same textbox

Any one with a briljant idea of how to sovle this.

View 9 Replies







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