Instance A Class, Based On Other Classes, Add New Properties?
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
ADVERTISEMENT
Feb 2, 2010
Whats the best way to instantiate a class so that i can have access to the object from diffreent forms and classes?
View 2 Replies
Aug 19, 2009
I have a class in which some of the fields are also classes.I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"But the code compiles fine.
dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error
How can i fix this ?
View 6 Replies
Aug 19, 2009
I have a class in which some of the fields are also classes.
I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"
But the code compiles fine.
dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error
View 4 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
Dec 20, 2011
As an ameture developer, I've never really used classes. However, I've been reading about using classes and automatic properties. I have therefore created a class which looks similar to this:
Public Class Quote
Property QuoteNum as integer
Property AccNum as String
Property Price as Decimal
End Class
The stumbling part for me comes in the way of letting form2 know which class form1 has initialized. There are in this example 3 forms to this wizard. If someone starts another wizard whilst half way through the first wizard we need to keep the variables seperate hence using the class. I think I'm along the right track, but maybe confusing myself a little.
[Code]...
View 12 Replies
Aug 6, 2010
Here is the structure that I have:
Friend Class StandardFormatFile
Friend fileType As String
Friend numberOfSeries As Integer
[code].....
View 3 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
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
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
Jul 14, 2011
I`m a beginner in programming and i`m having problems calling an instance of my nested classes. I`m using VB.net and my code is something like this
[Code]....
View 3 Replies
Jan 1, 2012
I have Class1 and class2 which is inside class1, VB.NET code:
Public Class class1
Public varisbleX As Integer = 1
Public Class class2
[code]....
View 1 Replies
Apr 27, 2010
vs2010 vb.net QUESTION1 If i do a select and fill a datatable and want to access that data from another class. How can I do that? QUESTION1 example
[Code]...
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
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
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 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
Jun 7, 2012
I want to created a nested class that can only be visible to and instantiated from the parent class.But I also want to be able to use an instance of the nested class through a public variable of the parent class.I tried making the nested class private, or making the nested class' constructor private, but it won't compile.Is it possible to do this in .NET?
[Code]...
View 3 Replies
May 10, 2010
I am creating an Add-In that I want to create classes and forms based on a database structure. I can't find any information anywhere on how to programatically add code to classes. I know I can write out the files and add them to a project, but that would limit what I can do in the future. I would like the possibility to update a function in the future which would be impossible writing out a file and loading the whole thing back in. It would destroy any modifications made to the class, and since this Add-In will only be creating a framework, there will usually be modifications.
I got this line from the macro recorder:DTE.ActiveDocument.Selection.text = strDACode
But I like to keep Option Strict on, and this is late bound according to the IDE. There seems to be very little help on the IDE and how to use it creating Add-Ins. If I overlooked something please point me there, but I can find nothing. I don't know if it can be done, but I was able to do it in an Add-In for VB6.I would also like to add controls to a form, so if anyone can point me somewhere where it explains
View 3 Replies
Jan 18, 2011
my proble is the following: I have a class MyClass and another class Modifier, which has a method ModifyMyClass(ByRef mc as MyClass) that receives a MyClass instance as ByRef parameter to modify it. A smell of the code is:
[Code]...
View 4 Replies
May 6, 2010
If you run this code you will see that the 500 PictureBoxes that are added ( this is easier to show than adding pixels as a pixel is only a single point ) fall mainly on the diagonal.With regard the RANDOM class, why should this be like this when the bounds of the instances are? >>
p.Location = New Point(x.Next(0, Me.Width + 1
), y.Next(0, Me.Height + 1 ))
as in this code.>>
[code].....-2138214fdeb4
View 9 Replies
Dec 29, 2010
This is another one of my "I think it's not possible but I need confirmation" questions.I have a base class for a bunch of child classes. Right now, this base class has a few common properties the children use, like Name. The base is an abstract class (MustInherit)Technically, this means that everytime a child class is instantiated, it lugs around, in memory, its own copy of Name. The thing is, Name is going to be a fixed value for all instances of a given child. I.e., Child1.Name will return "child_object1", and Child2.Name will return "child_object2".
View 1 Replies
Feb 2, 2009
i'm currently trying to test a program at home that i've written for an assignment at university. At the university they have a dedicated SQL server that i can connect to fine enough but to test and debug at home i have installed MySQL 5.1.
I now have trouble connectioning to MySQL the error message i get points towards that my program is acutally looking for an instace of MS SQL server and i don't know where to change this.
I have downloaded and installed "MySQL ODBC Driver-MyODBC 3.51" which some people have suggested corrects the problem, unfortunatly this doesn't work.
The current code i have is:
Dim strConnBuild As New SqlConnectionStringBuilder
With strConnBuild
.DataSource = "localhost"
.InitialCatalog = "northwind"
[code]....
I can't find any properties of the SqlConnectionStringBuilder that indicate what instance and protocalls it should use.
View 1 Replies
May 18, 2010
I've createda vb.net class library where I've defined a number of small classes... nothing complicated, just working with strings, sending emails, etc.In another project, I reference the class library and I'm seemingly able to create an instance ofone of tclasses - intellisense shows me all of the plic properties, methods, etc... all looks perfect. No compile errors at all, nothing b gumdropsand lollipops.When I run the app I'm working on that references the class library, it fails at the point where I'm creating an instance of the class and gives me a vague exception, "System.TypeLoadException".
View 2 Replies