"serialise" Object - Add The Attribute To The Instantiation Of BList?
Apr 13, 2010I have Form with the following code -
[Code]...
I have Form with the following code -
[Code]...
VB 2008 .NET 3.5 Suppose we have two classes, Order and OrderItem, that represent some type of online ordering system. OrderItem represents a single line item in an Order. One Order can contain multiple OrderItems, in the form of a List(of OrderItem).
Public Class Order
Public Property MyOrderItems() as List(of OrderItem)
End Property
End Class
It makes sense that an OrderItem should not exist without an Order. In other words, an OrderItem class should not be able to be instantiated on its own, it should be dependent on an Order class to contain it and instantiate it. However, the OrderItem should be public in scope so that it's properties are accessible to other objects. So, the requirements for OrderItem are:
[Code]...
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.
I am having some real issues with this one. I have a class which contains two other objects...but I cannot seem to instantiate those sub objects. Here is the code for my class:
Option Explicit On
Public Class Boot
'A collection of Heads and Shells
[Code]....
Notice the count for my two objects, Ohead, and oShell, is zero. Im not sure why this doesnt instantiate properly, as I believe is what is going on.
i have got a object of attribute and i want to know what is its node name (who contain this attribut).
View 2 RepliesI am writing some code to bring in an arraylist. I want to print an attribute of the object for the arraylist (see red below). I cannot conclude how to get at it.
Code:
Public Sub drilldown1(ByVal DOC As IPDMWDocument)
' Drill-down levels from top level document
Dim f As String = "drilldown1"
I have a list of objects, each object has a score attribute,The list of scores needs to be combined on the player ID to become a totaled score or series. My current thought process is to For Each through the list of individual games, and add the score attribute to a new list of scores with the same objects. So one list would be like:
clsGame(ID Number, Sore)
dim ScoreList as list(of clsGames)
ScoreList.Add(New clsGame(11, 244)
ScoreList.Add(New clsGame(11, 333)
ScoreList.Add(New clsGame(11, 444)
Then go through combining on like ID's to make a new list of games, that would actually be the series.
Dim SeriesList as new list(of clsClasses)
For each game as clsGame in ScoreList
'cycle through the list of series seeing if an ID matches, if so add the score onto that ID
Else
[code]....
Now I don't know how to add the player if its not in the seiries list without doing a heck of a lot more for each statements. If I add it after the end if then it will be added even if it is in the list..I tried playing around with List.Contains method, but I could only see if it contaned the exact same values i.e
SeiresList.Contains(game)
and because the scores are different (series vs single game) it wouldn't match, and I don't know how to see if it contains an object with just one of the attributes the same...
I was just wondering if it is possible to apply an attribute to a property within a business object (MyBusinessObject) such that after the DataSource of a grid is set to a List(Of MyBusinessObject), the visible property of the column will automatically be false. For example:
myGrid.DataSource = New List(Of MyBusinessObject)
Public Class MyBusinessObject
[code]....
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]...
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 RepliesI have a class:
Form
Public Class Form1
Dim teamlist(2) As team
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
teamlist(0) = New team(1, "one", "First")
[Code] .....
Error I'm getting is too many arguments.
I can't find what's going on with the following nHibernate HQL.
here's my VB.Net code:
Return _Session.GetNamedQuery("PersonAnthroSummary").SetInt32(0, 2).UniqueResult()
My Named Query:
[code].....
I just like to know if how can i do single form instantiation upon loading my Form..upon loading my MainForm it automatically detect if that MainForm is still exist..ive try putting my code in the contructor of my MainForm..i check through the process in the task manager if that MainForm is still exist..but i think this is not the good idea bcoz..the MainForm takes several seconds to appear..and i think this is bcoz i loop through the process.
View 1 RepliesI have several similar classes but only want to instantiate one of these classes dependant on a selection from my main form.
View 4 RepliesI can insert values into a VB.NET Dictionary when I create it? I can, but don't want to, do dict.Add(int, "string") for each item.
Basically, I want to do "How to insert values into C# Dictionary on instantiation?" with VB.NET.
var dictionary = new Dictionary<int, string>
{
{0, "string"},
{1, "string2"},
{2, "string3"}
};
In C#, you can do this:
new MyClass().MyMethod();
The method is executed and the reference is (typically) discarded since no reference to the object is kept.Is this possible with VB.NET (.NET v4)?
Edit: I suppose this is a better example:
new Thread((x) => doSomething()).Start();
What I want to do is pass a Type to another object's constructor, where the other object creates a new instance of Type. I can create a constructor with a parameter declared as System.Type without problem, but when I try to instantiate it tells me there is no such type.
Public Sub New(targettype As System.Type)
Dim Test As System.Windows.Forms.Form = New targettype
End Sub
I don't know if this has been asked before, but we're having a discussion about it today at my job. Should private variables (that are shared/static) be instantiated when they are dimensioned/defined, or is it a better practice to do this inside of a constructor?
Public Class IpCam
Private Const HOST As String = "http://test.com/url/example"
Private Shared _Example As New OurClass(HOST)which one to use?
[code].....
i have an application that have been working correctly, but sudenly shown an error as this: Error at create form, Exception.InnerException. When i execute debuger show error at the instantiation variables as xmldocument, control or decimal.
View 1 RepliesSo I'm just trying to understand why someone would want to use the shorthand property instantiation
Public Property CarModel As String <-- property
As opposed to
Public CarModel As String <-- variable
Is there a way to call functions within a class upon instantiation of that same class? Basically, I have functions within a class, but I want to automatically call some of those functions simply when there is an instance of the class created.
Basically, I have this structure:
Dim instance as new class
instance.function1
instance.function2
[Code].....
I am somewhat new to object oriented programming and am attempting to flatten a Linq object hierarchy by using a shim class.how to initalize a derived class with property values from a base class?I have two objects, a base object with about 100 properties, and a derived object which inherits from the base object and adds a few additional properties beyond those of the base object. My simple constructor creates the derived object, but I am looking for a way to initialize the derived object properties with values from the base object.Right now I am using reflection to iterate over the properties individually and I suspect there may be a better way. The following example shows my shim class constructor for the derived class, and two properties:
newProperty1 - a new string property of the derived class
flattenedProperty2 - a new string property of the derived class, copied from a 2nd-level object of the base class
Code example:
Public Class derivedObj
Inherits baseObj
Private _newProperty1 As String[code].......
Is this the correct constructor approach to flatten the object hierarchy using a shim class? My second question relates to initialization of properties in the derived class. The constructor above creates the derived object, but what is the best way to initialize the derived object properties with values from the base object? The following code uses reflection to iterate over the properties individually, but I suspect there may be a better way.
Code example:
' property names are in the string array fieldNames
'baseObjQuery is an ienumerable of baseObj
'derivedObjList is a list of derivedObj[code].....
Is there a simple way to initialize values for the properties in the derived object based upon the values of the common properties in the base object?
The problem im having grabbing the attribute names out of xml document. Here is the snippet:
<RUNWAY name="02X" length="3507" slope="-0.11" level_off_height="2228">
I have created a loop to display the results. In the snippet above, how do i grab the attributes name(name, length, slope, and level_of_height). I have used reader.name is giving me RUNWAY which is correct as the elements name. I tried getAttribute and it give me all of the values of the attributes, but not there name.
Imports System
Imports System.Reflection
Public Module Module1
' An enumeration of animals. Start at 1 (0 = uninitialized).
[code].....
' Output:
' Method DogMethod has a pet Dog attribute.
' Method CatMethod has a pet Cat attribute.
' Method BirdMethod has a pet Bird attribute.
i get this code from Attribute Class but how to use it in my application..
i have some xml like this:
Quote:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<zylab>
<document version="1.1" guid="{5BB6C5FF-FDA4-4FC5-99A2-20CFDF5651FE}" date="20060928" time="00:13:12.017" size="35595" path="E:YIMAGEINDEX DATAPBITXT2006�0000000" name="200001TR.TXT" key="">
<fields>
[Code]...
I have been parsing xml content using the xmlreader and cannot use the xml document but so far it works getting all elementcontent except for the attribute contents. I need to parse the link below found in the following entry;[code]
View 2 RepliesWhen is it run? Does it run for each object to which I apply it, or just once? Can it do anything, or its actions are restricted?
View 3 RepliesIn my VB 6.0 code, I declare have the following line[code]...
However, in VB.NET, I get the error "expecting declaration". Isn't this a declaration statement? Is there a good reference for finding the differences between VB.NET and VB 6.0?
I am converting C# code to VB.Net and the C code has this above the function:[return: System.Xml.Serialization.XmlElementAttribute("Name", IsNullable=true)]
View 3 RepliesI am trying to add an ID HTML attribute to a form using ASP.NET MVC and VB.NET
<%Html.BeginForm("Create", "Model", "", "", New With {.id = "CreateForm"})%>
This gives me a type error, since .id is expecting an Integer, not a string. How do add an ID attribute to my form?