[2008] Properties/classes And Generics?
Jan 9, 2009
what I would like to do is create a class that has a few private properties and one public property.the end result of the class is to return a list(of servers)below is what I am thinking. My brain just can't come up with the correct answer.
namespace sample
Private _servername As String
Private _farmname As String
[code].....
View 1 Replies
ADVERTISEMENT
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
Jan 23, 2012
I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.
View 2 Replies
Sep 24, 2010
so far i got
code
For Each item As Reflection.FieldInfo In GetType(NameSpace.ClassWithNestedClasses).GetFields
rtfAppend(item.Name & ":" & Tab & item.GetValue(Me))
Next
For Each item As Reflection.PropertyInfo In GetType(NameSpace.ClassWithNestedClasses).GetProperties()
[code]...
which gets me the simple string vars and properties of my top class, but how can i apply this to loop through all sub classes and get there vars and props?
View 1 Replies
Oct 21, 2009
I have Form Class A, which is the "Main Form". An Event fired by Form A instantiates Form B, and sets Form A as it's owner. (which makes it be on top of FormA at all times)[code]...
View 4 Replies
Feb 4, 2010
Accessing Properties Of Form Classes
View 1 Replies
Jan 12, 2011
Let's have three classes;
Line
PoliLine
SuperPoliLine
[code]...
View 3 Replies
Dec 3, 2008
Seems like you should be able to Suppress Properties in inherited classes. How do you do it?
View 7 Replies
May 21, 2010
I have two custom attributes defined like so:
internal class SchemaAttribute : Attribute {
internal SchemaAttribute(string schema) {
Schema = schema;
[code]....
I would like to restrict the SchemaAttribute to classes, and the AttributeAttribute to properties.Is this doable?
View 2 Replies
Feb 27, 2009
I am a vb.net newbie, so please bear with me. Is it possible to create properties (or attributes) for a class in visual basic (I am using Visual Basic 2005) ? All web searches for metaprogramming led me nowhere. Here is an example to clarify what I mean.
public class GenericProps
public sub new()
' ???
[Code].....
View 3 Replies
May 26, 2009
You know how everyone says "C++ is like C with classes"?How similar is it to .NET classes? instance a class, based on other classes, add new properties, override existing properties, etc?Are the variables strongly-typed and declared before they are used? Or is it a Duck-Typing language like Python?
Also, does it have its own Garbage Collector that disposes of objects when the pointer exits their scope,or do you have to manually clear and get rid of them when you finish with them? What's the difference between native C++, and the "managed C++" in Visual Studio? Because I'd prefer to use native code if its not too much harder. for the sake of all that is good and holy, don't use ACCESS, EXCEL, or a TEXT FILE as a database. If you want your program to use a "local database", without any of the hassle of setting up a MS SQL or MySQL server, just click this link: >>> SQLite <<< Seriously. This is for your own good.
View 3 Replies
May 27, 2010
I am working on a bitmap class module in Visual Basic 2010 that has an option to create a graphic grid on the bitmap.
[code]...
View 3 Replies
Mar 16, 2010
Sorry if this is a bit random, but is it good practice to give all fields of a class a value when the class is instanciated? I'm just wondering if its better practice to have a constuctor that takes no parameters and gives all the fields default values, or whether fields that have values should be assigned and others left alone until required?
View 4 Replies
Feb 15, 2012
what's a Class, and Object, a Method, a property and thins like that, but I have this doubt:Let's supppose I have a class "Laundry" this class has (just for this example) 3 propierties:
1.- laundryID
2.- Name
3.- Washers
Id and Name are "primitive" types or simple types (integer and string), but Washers, represent a list of object of type "Washer", that has 3 properties:
1.- washerID
2.- laundryID
3.- capacity
4.- brand
All of them (for this example) simple/primitives types (integer,string,string).So this my dilemma, it is correct to have a constructor like this (VB .net)
public sub new(ByVal laundryID as integer)
'' Here I'll query for the data of the Laundry on DB
'' After that I will query for every washer that belongs to this laundry
[code]....
And inside of that constructor query for all the washers that belongs to the laundry with id=laundryID parameter, and create objects of type "Washer" and add them to the list of Laundry ?I'm not sure If I explain myself, any comment I'll be really grateful, in less words, what's the correct approach (or good practices) to work with class/objects that has properties which are complex (other class/objects).I usually work with ADO.net probably ADO/LINQ/Entity solve this thins in an transparent way, but if they do it I don't really know it.
Note: I'm familiar with VB.net, C#, PHP, so if you prefer explain/help me using examples with its syntax, it's ok
View 2 Replies
Aug 8, 2011
Background:I have a base class and several inherited derived classes. The derived classes don't always need to have the same properties. If any properties are shared among the derived classes, those properties would live at the base class level ('Contents', for example).Similarly, GoodDocument below has 'GoodThings' but would not want/need to have 'BadThings'.I want to treat instances of both 'GoodDocument' and 'BadDocument' as type 'Document'
public mustinherit class Document
public property Contents as string
public sub new()...
[code]....
View 3 Replies
Jun 26, 2010
I want to know what are classes , objects , a namespace , subroutines,functions,methods,properties and differemce betweem byval and byref in your words.
View 18 Replies
Jun 23, 2009
The idea is to expand on the existing, old, and lacking Inputbox, to allow for:1. A greater variety of types (Integers, doubles, List(Of String), etc.2. Data validation.For example, if the user wants the user to quickly enter an Integer, I want a custom Inputbox form to show up with a TextBox, which only allows Integer input. If he wants the user to choose from a List(Of String), I show a form with a Combobox instead, from which the user can then choose.
View 8 Replies
Oct 7, 2011
I am trying to implement a sub-class as a property of another class. Eg:
[Code]...
View 9 Replies
Jun 13, 2012
How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:
Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()
[code].....
So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:
interface.Economic.MyMethod
interface.Currency.MyMethod
etc
This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.
View 23 Replies
Oct 24, 2009
Here is some example code of what I mean:
vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click
[Code]....
View 5 Replies
Jul 10, 2009
I m trying to raise Click event of Textbox explictly but I m getting "Derived classes cannot raise base classes" error.[code]....
View 1 Replies
Jul 15, 2009
If I have something like this within a sub/function:Dim a as new myclass...Does this leave a memory leak if I am constantly calling this function creating new instances of this class? Do I have to destroy it or something when I am done using it?
View 2 Replies
Oct 6, 2009
I have a Tcp Client which I created on an application form but now I would like to create a class for it.
My prob is that when I check for any incoming data, I used to start a new thread. When this new thread finds any incoming data, I call a sub which invokes the form and everything works smooth.
This is what I am talking about,[code...]
How would I be able to do the same from a class? Or I dont have to create a separate thread when using classes?
View 2 Replies
May 3, 2009
I have built a new class lets say it is called class1
Public
Class Class1
Public s As String ' strings
End
now in my program I want to create an array of them in on the windows form, how do I do this?Class
View 2 Replies
Jun 27, 2011
I am having trouble getting inheritance to work with the VB 2008 Express entity classes. I am a beginner with VB.Net and self-taught in VB6.0.I am able to pull data from an SQL Server data base into my application using the O/R designer. The data can be successfully queried using LINQ to SQL, either returning a single record, or multiple records or an entire table as a collection of the enty class type (so the problem is not with LINQ queries).
View 2 Replies
Feb 18, 2010
I am curious as to the proper technique to use SQL Server's AppRole with a LINQ to SQL Class. I understand I have to establish the intial connection with no connection pooling. However, do I simply call the SQL stored procedure sp_setapprole using standard LINQ before executing any of my methods that interact with the database, or is there a better way to enable and use AppRole within the LINQ to SQL class?
View 6 Replies
May 14, 2009
I'm running into is some of the namespaces aren't being recognized. After searching the internet it seems I am supposed to have more than just System.Management.Instrumentation available to Import/Reference.However, that is all I can access.I need System. Management. ConnectionOptions and a few others, but don't know how to get these.Do I need to install the WMI SDK, or maybe the WMI Win32 Classes?
View 2 Replies
Apr 16, 2011
For some reason I can't import the classes that I created. I'm not sure why. Can anybody help me out? I added a namespace, but it still isn't working. I need to add these classes to an ASP.NET website for school. However, my imports statement doesn't even show the option. What am I missing?
[code]...
View 1 Replies
Apr 1, 2010
Briefly, what I'm trying to do is add some methods and properties to the FileInfo class, which is sealed (NotInheritable). As far as I can tell, I have two options to do this.
1) Inherit from FileSystemInfo (the base class for FileInfo) and recreate the methods and properties added by FileInfo (essentially recreating the FileInfo class from scratch)
2) Use extension methods (??) which I just learned about two minutes ago and it being 1am, I'm going to get into this tomorrow
3) Create a wrapper class around a FileInfo object - I think that's the proper term
Ok, so I guess there are 3 options.
A) Why make a class uninheritable
B) Is creating a wrapper class "basically" the same as inheriting from an object, but at least with inheritence you don't need to create any properties and methods other than those you want to modify or add?
Am I correct when I say that a Field is a protected property that can only be accessed by the base class and inherited classes, or is the definition of a field something else?
View 2 Replies
Dec 31, 2009
This might be crazy but can I (well I know I can do this first part) and create a folder in my Solution Explorer and put classes in there, just so my main form is kept clean, as I only have a couple of forms but there is a lot of code.I thought I would call a class "Panel1_Work" and have all the panel one stuff go there, i.e I have a code which is going to sort a datagridview but i'll write my own function or sub for this as it will be getting called from a few different places.
View 1 Replies