.net - Separate Metadata From The Class Definition Across Assemblies?
May 24, 2011
I'm working a business layer (separate assembly) that will contain various business entities used in multiple client applications. One of the client applications is a WCF app that will need to serialize these entities. In order to properly serialize the entities, metadata for data contracts or for XML serialization must be added, but the serialization requirements may vary across applications.
Clearly I need the metadata separated from the class definition. So how do I add metadata to my entities for each separate application?
View 1 Replies
ADVERTISEMENT
Dec 10, 2010
If we are within the derived class then ofcource we can use MyBase keyword to access base class's object reference . That's fine , how can we take that base class's object reference outside that derived class's definition.My following code will explain what i want . Actually that is giving error right now, but it is explaining my requirement .
Public Class Base
Public x As String
End Class
[code]....
Actually there is error in ReadOnly Property BaseReference's Getter . Error is "Error 1 'MyBase' must be followed by '.' and an identifier. " how can i get base class object reference in Main method ?
View 1 Replies
Jan 13, 2012
I have a VB.NET project and a C# project in the same VS2010 solution. The VB.NET project is referenced (and used) by the C# project as a project reference. If while I am in the C# project, and I Ctrl-Click or Go to Definition on an element that is part of the VB project, it takes me to C# generated metadata instead of the actual VB code file.Is there any way to get this to go to the VB code file, so I dont have to navigate manually in solution explorer/navigator?
View 2 Replies
Aug 4, 2010
I have a class definition that I've seen other define properties that return collections of objects.
Public Property GetAllAdults() as Adults End Property I made the argument that this should be a method in the class, because it doesn't define an attribute of the class, and could not be extended with parameters. Is/Are there reasons why this should be defined as a property vs. a function?
View 3 Replies
Oct 9, 2006
How do I creat a simple array of class definitions?[code]...
View 13 Replies
Jan 11, 2010
I'm having trouble with the definition of an inherited generic class. I have two base classes that are defined like this:[code]
View 2 Replies
Aug 8, 2010
I call upon the VB ninjas out there. Here's my situation. I need to eventually be able to pass multiple models to a view. Currently I have a linq to sql class that, of course, has a bunch of generated model definitions. I need to make a model that implements multiple models. I somewhat understand how to do this in C#, but this project is testing my VB skillz. Here's some snippets from my linq to sql models. I need to combine these two into one model to pass to the view.
[Code]...
View 1 Replies
Jan 4, 2010
I have a base class which needs to define an enumeration:
BaseClass
- SomeEnum
I then need to create two derived classes from the base class and extend the values in the enumeration:
ChildClass1 : BaseClass
- SomeEnum
- SomeEnumValue1
[code]....
In C# or VB.NET can someone provide the syntax to do this?
View 3 Replies
Feb 10, 2010
In order to organize various methods of my MainForm class, I would like to categorize them into several files. Of course, the methods would still need to access form elements and additional variables I added in the MainForm class.
View 3 Replies
Feb 13, 2012
If we are within the derived class then ofcource we can use MyBase keyword to access base class's object reference . That's fine , how can we take that base class's object reference outside that derived class's definition.
My following code will explain what i want . Actually that is giving error right now, but it is explaining my requirement .[code]...
View 6 Replies
Jun 22, 2010
I see a sample code that an object is instantiated within the class definition block. But when I test the folllowing, I got error "Process is terminated due to
[Code]...
View 3 Replies
May 18, 2008
I am currently using reflection to retrieve all properties of a class. I return a collection of PropertyInfo objects and all is working fine.
My problem is, I want to check if a property has been defined in a base class implementation and is therefore inherited in the current class.
View 2 Replies
Sep 14, 2009
I have 3 classes that need themselves in order to do their work but if I declare them the old way it would end up being an endless loop.
As an ex C++ programmer, I know I could use include once but I don't know if there is any equivalency in vb.net Here is the picture.
I have 3 Classes : SQLConnector, ErrorHandler, LogHandler
- ErrorHandler needs SQLConnector to get some IDs from the Database.
- ErrorHandler needs the LogHandler class to prepare the Logs to be... logged.
- SQLConnector needs the ErrorHandler class in case there is errors happening.
- LogHandler needs SQLConnector to insert in the database.
- LogHandler needs ErrorHandler in case the insert is not successful (sends mail in that case)
As you can see, all three classes are needed. The reason why I can't use LogHandler and ErrorHandler as one class is that I will use that class to log transactions and changes according to some parameters. Log is in no way exclusive to ErrorHandler.how I can prevent to make an endless loop and use all three of them as I wish?
View 11 Replies
Jul 28, 2011
In a global module, I define a new type that can take 4 values:
enum tAction as integer
None
Update
Insert
Delete
end enum
A use this type in many places in my code to check the value stored in a variable (if MyAction = tAction.Delete then ...)
In a separate file, I define a class. One of the properties should return a value of this type:
public class XXX
private _Action as tAction
public property ClassAction() as tAction
[Code].....
This way I could check a class property in the same manner (if MyClass.ClassAction = tAction.Insert then ...)
However I get a syntax error in the property definition: 'ClassAction' cannot expose type 'Globals.tAction' outside the project through class 'XXX'
My entire program consists in a few modules, in a single project. How can I use my tAction definition in my classes?
View 4 Replies
Dec 10, 2011
I'm trying to return code like this (can be found here):
{"hotspots": [{
"id": "test_1",
"anchor": { "geolocation": { "lat": 52.3729, "lon": 4.93 } },
[code].....
View 2 Replies
Mar 8, 2010
Can you define this :
Class
Object
Inheritance
Polymorphism
Abstraction
And could you make it easy to understand I'm having a hard time to understand those terms.
View 7 Replies
May 13, 2011
Example:
Two files - TestClass.vb, myForm.vb
TestClass.vb looks as follows:
Imports System.Threading
Public Class TestClass
Private myClassThread As New Thread(AddressOf StartMyClassThread)
[code]....
The result:Application runs, no errors or exceptions.Displayed is the listbox and the Start button.I press the start button and a msgbox says "Not Invoked" as expected and upon clicking OK to that msgbox "Start Button Pressed" is added to the Output listbox control.Immediately following that the msgbox pops up again and says "Not Invoked". I was expecting "Invoked" as a separate thread is trying to use the Output listbox control.Of course this results in the Output.Items.Add being attempted which results in no visible result as the thread is not allowed to directly update the UI control.
View 1 Replies
Nov 22, 2009
Good evening folks, I'm building a program that is threaded. While I can get the thread to work no problem, I can not seem to add pages to my tabcontrol from the class I'm using. Any idea's on what I'm doing wrong?frmMain is loaded first. Then the idea is to load the other tabpages using a separate thread as they take awhile.[code]
View 1 Replies
Jan 20, 2011
I am having following Projects
ClassLibrary1
Public Class Class1
Public Sub MyMethod()
[code].....
View 12 Replies
Feb 11, 2011
I don't want my application's main form to be displayed when it opens; I just want the notifyicon control in it to show in the taskbar.This is the code I have been using:
Module:
Code:
Module mdlStartup
Public Sub Main()
[Code]...
The NotifyIcon control is in my frmMain. However, when I run my program I get mulitple instances of the Notify Icon being displayed. I even get two frmMains getting launched if I try clicking the other tray icon that has been made. I'm guessing this has to do with the New instance.If that's the problem, is there a way I can move the notifyicon control to some completely separate class?
View 3 Replies
Feb 7, 2012
Im trying to get a ComboBox that would list all the pc on a netowrk, (Domain and/or WorkGroup)the idea is so that when i start typing the name of the pc list would come up with sugestions (nearest match)
[code]....
View 2 Replies
Nov 6, 2008
How can I move the following to a separate class for repeated use ? (the problem is that it uses response object)
' Download/View a given file
Protected
Sub downloadFile(ByVal sFile
As String)
[code]....
View 1 Replies
Aug 5, 2011
I have a listbox in separate class like this [code]
[Code]...
How can I use that list box that I have created in that class on this form or I want to show that listbox on my form?
View 3 Replies
Feb 23, 2012
this example shows my problem. I'm using VB.net 2010
Public Class Form1
Public Class BonoType
Public name As String
[Code].....
What happens is "Goose" is not only stored in tory(1) but also in tory1(1), how can I stop this.
View 2 Replies
Apr 18, 2009
I'm writing a program and rather than having all the print properties in the main form I'd like to have them setup in a seperate class. I've done printing before by setting all the properties in the form where all the controls are located with no problems but this has me stumped. Reason for doing this is just to try and organize the program a little better and there are several areas of the program that will have different data and format to print so this will cut down on having potentially hunderds if not a thousand lines in that one area. I can't imaging that this wouldn't be possible.
View 1 Replies
May 4, 2010
The code below works fine when I put it in form1.vb and change "form1" to "me" but I can't seem go get it to work from my class.
VB
Imports System.Threading
Public Class Class1
[Code].....
View 2 Replies
Oct 18, 2009
I need to be able to access a progressbar in my form from a separate class.
I tried
Dim Prog as Progressbar
Public Property Pg()
Get
[Code].....
I need to be able to access a control from a separate thread and return to the thread again.
Edit: Its just an example I gave prog a value of the object from the form and the invoke required is put in a sub so thats not my problem.
View 3 Replies
Jun 22, 2010
I have a class, called myClass.vb. I have a sub in it. this sub has a string variable, which has got some value. Now, i want this value to be transferred to the button_click event of a very seperate form called myForm.vb.
View 3 Replies
Jun 21, 2010
I didn't think this would be a problem, but it appears that others also search for this solution. There is an annoying DING! when hitting the Enter key in a ComboBox in VB.Net so I sought solutions. Here is the solution I am working with. I created a new seperate Class within my Project...
Public Class ClasscboBox
Inherits ComboBox
[CODE]...
Looks good, but I am having a problem calling it from the main project. Here is what I have tried using...
Dim objcboBox As New ClasscboBox
objcboBox.OnKeyPress(KeyPressEventArgs)
However, it says thatKeyPressEventArgs is a Type and cannot be used as an Expression. I tried 'e' but no go. I am a little ahead of my classes (no pun intended) so I am likely missing something about what I am doing wrong.
I have three comboboxes so I though this would best suit my needs in the interests of writting decent code and not populating each call with repeating code.
View 16 Replies
Feb 24, 2012
I've been searching for the answer for a while but can't find it yet. Basically so far I have a simple VB.Net form with one button.I would like to make a class or module that can handle events from the main form. This is my code so far but it doesn't seem to work.
View 6 Replies