Asp.net - Inherit Same Method For 2 Different Class?
Sep 22, 2010
How to simplify this, 2 method in class are identical.First class.
Public Class Gui
Inherits System.Web.UI.Page
Public Sub CreateStyleLink(ByVal StyleArray() As String)
[code].....
View 1 Replies
ADVERTISEMENT
Dec 19, 2010
How to simplify this, 2 method in class are identical.[code]
View 3 Replies
Nov 25, 2011
I have a large problem with inheritance in vb.net. The problem is the following:
I have 2 forms => frmBase and frmChild
In frmBase i want to create a method Called StartWorking() and i want frmChild to inherit this method.
But here is the tricky thing: when frmChild.StartWorking is called i would like the following => without calling MyBase.StartWorking()
I want frmBase.StartWorking() to be executed first and after a test in frmBase.StartWorking if blnValue is true then frmChild.StartWorking has to be activated. if blnValue is false that frmChild.StartWorking cannot be activated.
View 2 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
Jan 21, 2010
I can do this without problem.
Class A
End Class
Class B : Inherit A
End Class
Dim Obj1 As A = New B
View 4 Replies
Jun 18, 2009
class inherit from another class and implement an interface?
View 4 Replies
Oct 19, 2010
Consider a MyForm class that contains a shadowed implementation of Show(). It also contains a CreateForm() method, which accepts an instance of the form and calls the shadowed sub:
[Code]....
View 3 Replies
Apr 29, 2009
I have the following sample code in a VB.NET console application. It compiles and works, but feels like a hack. Is there a way to define EmptyChild so that it inherits from Intermediate(Of T As Class) without using the dummy EmptyClass?
Module Module1
Sub Main()
Dim Child1 = New RealChild()[code].....
The other way to do this would be to move the generic code out of the Base class and then create 2 Intermediate classes like this [code]...
Then RealChild would inherit from the generic Intermediate and EmptyChild would inherit from the non-generic Intermediate. My problem with that solution is that the Base class is in a separate assembly and I need to keep the code that handles the generic type in that assembly. And there is functionality in the Intermediate class that does not belong in the assembly with the Base class.
View 1 Replies
Mar 15, 2010
i'm working with different classes and different constructors. It's working fine until i try to inherit a class that also has a constructor. vb asks for mybase.new but when i add that vb says that a constructor cannot call itself, when i try it in a different way vb asks the parameters of the constructor of the class that i want to inherit.
View 11 Replies
Aug 25, 2009
By Default code behind looks like --
Partial Public
Class InhAbs
[code].....
View 2 Replies
Dec 16, 2009
why is it that Strings are declared notinheritable? plus is there a base class of Integer for us to inherit from?
View 7 Replies
Jul 2, 2010
<edit on 7th July, 2010. Please see my 4th post in this threadfor the reason I have marked the post by bpellAS ANSWER </edit>
View 1 Replies
May 30, 2011
How to create a class which inherits from a data type, specifically from Char data type? I just want to add one property to it. If it's not possible, are there any other ways to accomplish this?
View 2 Replies
Dec 26, 2011
I have problem in Form controls. I inherit label control in a class Mylabel i use this label on my form not standard label control. now i want change the Font all Mylabel in my form then it not change Font when i use standard label control it's work.
I use this code
For Each Ctrl as Control In Me.Controls
Ctrl.font= new Font("Arial",10)
next
View 2 Replies
Apr 27, 2010
I am writing a game editor, and have a lot of different "tool" objects. They all inherit from BTool and have the same constructor. I would like to dynamically populate a toolbox at runtime with buttons that correspond to these tools, and when clicked have them create an instance of that tool and set it as the current tool. Is this possible, and if so will it be better/easier than creating those buttons by hand?
View 3 Replies
Feb 17, 2010
my form displays locations and owners for a same product, the forms have a data grid view that actually takes in the details of the location and owner of that particular product. a product can have multiple owners and locations once its manufactured over time, the forms actually display this all i need is some kind of business logic that can actually manage the historical events of the location and the owner that when a user actually goes in and adds a new entry, the end date of the previous owner gets reduced to one less than the start date of the new owner. this in formation is stored in business layers called the owner collection and the location collection, i am not able to actually inherit or call the location or the owner collection class in the classes.
View 1 Replies
Oct 15, 2011
I am cleaning up some code and I have multiple classes that are 99% exactly the same. So my understanding is that my options are...
1. Create a class and all other classes inherit from it and modify it a bit
2. Create an abstract class and all classes inherit from it and modify a bit ** I took this route
3. Create an interface and all classes Implement that interface.
Here is my 'original' class below (the one that all of them look 99% identical). This class is used in an arraylist so I have a listing of all my images from a folder I have searched.
[Code]...
View 10 Replies
Feb 16, 2010
I will try to explain what I need.Let's say that I have a class like this:
Public Class Example1 Public Sub ToBeCalled()
[Code]...
View 5 Replies
May 24, 2012
I have a class like this
Public Class Settings
Private _app_folder As String = ""
Public Property AppFolder() As String
[Code]...
But how can I edit "_settings.AppFolder" property to "readonly" ?
View 4 Replies
Jan 15, 2010
i was trying to inherit System.Type. this is what i have:
[Code]...
and anyway the real problem is that inheriting System.Type without declaring my derived class as 'MustInherit
View 9 Replies
Oct 1, 2008
I've been creating short test apps repeatedly to try to understand some of the concepts in VB.NET.For the most part it has been illuminating.I read Bucky's .NET knowlegebase tutorial on passing objects as parameters to newly created forms. He shows how to create a new class that inherits from the base form class and define a New() method with parameters Extending the concept I thought about doing the same thing with a form that was created at design-time (In this case Form2).
[Code]...
View 6 Replies
Apr 22, 2012
Base class has one field to hold numeric balance value. With 2 methods that accept arguments for adding and subtracting the new input calculating new balance. Sub class has four fields dates, transaction, memo and amount.I have a deposit form, and withdraw form. Each time one transaction is entered it creates an object with sub class fields, then adds to the account collection. My problem is not understanding how to call the deposit/withdraw method and pass the current transaction amount back to the base class to alculate the new balance. Does anyone have any links to information/tutorials on how to perform something like this? As you can see with my code I have tried various different approaches without any success.
[Code]...
View 5 Replies
Apr 7, 2011
Supose a base class
Public Class airplane
Private var_num_seats As Integer
Private var_num_engines As Integer
[code]....
Obviously, I don't wish that the class Glider has the method "start_engines" neither the property "num_engines". Otherwise, other child classes may have. How can I supress these property and method in child class, not just ignoring (if I can)?
View 2 Replies
Oct 5, 2010
class
eg: dim classobj = xyz("CLASS_NAME") ' where classname is a valid class name
and dynamically raising a known method of that class on that newly created object or class reference.
[code].....
View 4 Replies
Mar 28, 2012
I am indifferent if you are a VB.NET or C# or other .NET developer. I have a FACTORY class like the following:
[Code]...
View 2 Replies
Apr 20, 2011
I'm writing a set of unit tests for a large, complex class called ImageEditor from a piece of legacy code, where image processing and GUI functionality isn't strictly divided. One of the methods in the class, BaseImageChanged, seems to be concerned entirely with how images get displayed and should be disabled in my unit tests to avoid unnecessary complexity. The test project is in C#, and the original code is in VB; my idea was to create a Decorator for the class in C# and then hide the method behind an empty one that does nothing. However, when I try running the unit test, the VB code keeps referencing the old BaseImageChanged method as though the replacement didn't exist. Here's what I'm doing:
(VB class)
Public Class ImageEditor
...
[code].....
View 4 Replies
Aug 13, 2011
I'm trying to code a class of RandomNumber. One of the class methods needs to populate a "List (Of RandomNumber)" ... which was passed as a parameter to the method ... with 10 random numbers between 1 and 50. DEAD SIMPLE :)
View 6 Replies
Feb 13, 2012
I know this is possible, and it is probably something simple that I am missing... I have a fairly complex class to handle deserialization of an XML file. I wish to place a [class].loadfile method within the class. It looks something like this: Serialization decoration left out for simplicity...
[Code]...
The Deserialization is working just fine (that's my own code), but assigning the object value to Me is not correct. What I want is for an instantiation of this class to have a LoadFile method (similar to the XML class LoadFile method) - but I cannot figure out how to set the value of the class from within the class.
View 3 Replies
Jan 9, 2012
I am getting an error when trying to call a form from within a method:
Expression is not a method
My code structure looks like this:
Public Class frmMain
Class Server
Private Shared Sub StringMessageReceived()
[Code]....
How can I call the windows form within the class?
View 1 Replies
Apr 29, 2012
I want to make an accelerate method that adds 5 to the speed field each time it is called?
[Code]....
View 13 Replies