Using Objects With All "Shared" Methods In Multi-Project Windows Application?

Nov 23, 2010

Have a windows application that "got complex" and new products could use many portions of the existing application.Decided to break app into multiple projects to facilitate sharing the appropriate pieces with new products.One object in app provides a library of text phrases used in the production of output docs.Wondering if such an object should be a set of shared methods instead of instantiating it in every object that consumes these text phrases.

View 5 Replies


ADVERTISEMENT

Anything Wrong With Using Lots Of Shared Methods And Objects

Jul 9, 2009

I seem to find more and more that I declare a lot of objects or methods as Shared now but it feels like I am not doing things properly.I try to avoid doing this but then I just end up with situations where I have to create an instance of a class just to call one method that would act no differently if it was just a shared method.Basically I'm just wanting to know if there is any good reason to avoid using Shared objects/methods. Obviously I dont declare EVERYTHING as shared, but it just seems to make things a lot simpler most of the time.For example in my current project (a chat application using WCF) I have a class just called Core which houses a lot of the main functions of the client program, so it has methods such as: SignUserIn, SignUserOut, SendMessage, MessageReceived etc and it also holds properties such as a list that contains all of the currently online users. These things are all declared Shared in my program because as far as I can see there is no reason for having to do this:[code]

View 15 Replies

Application Wide Shared Methods

Jul 26, 2011

I am developing an application that has multiple forms and I wanted to know the best method to have application wide methods and functions. Currently I am using a Module with all my methods that are needed to be used across the entire application in it. However, I read at one point that modules should not be used, as they are only there to preserve backwards compatibility with older VB code. Is there a better way to have methods able to be called anywhere?

View 1 Replies

.net - Why Can't Call Private Shared Methods From A Public Shared Method

Aug 25, 2011

I have a class like this:

[Code]...

It works, when I make getBar methods public, but I don't want to expose these unneccessarily. Why I can't call private shared methods from a public one in the same class is over my head. I'm using .net framework 4.0 in a web application.

View 1 Replies

Use Derived Class Shared Variables In Shared Methods Of Base Class?

Jun 4, 2010

I am trying to add shared members in derived classes and use that values in base classes...

I have base

class DBLayer
public shared function GetDetail(byval UIN as integer)
dim StrSql = string.format("select * from {0} where uin = {1}", tablename, uin)
end function
end class

[Code]..

currently there is error using the tablename variable of derived class in base class but i want to use it i dun know other techniques if other solutions are better then u can post it or u can say how can i make it work? confused...

View 2 Replies

Create A .net Windows Application In Multi-language?

Feb 23, 2009

If i want to create a vb.net windows application in multi-language (EnglishArabic). Is there any steps i need to do?I installed the Arabic at my windows XP and I am able to write the labels and the the textbox for example in arabic but is there a way for the controls to shifts automatically?

View 7 Replies

Shared Methods In ASP.NET Sessions

Feb 25, 2011

As a followup to the previous question I have asked "ASP.Net Architecture Specific to Shared/Static functions" I am still struggling to understand the implications of using shared methods in ASP.NET.

So for example let us take the following code.[code...]

View 3 Replies

C# - Static (Shared In VB) Or Normal Methods

Oct 27, 2009

I Want to know which one is preferred while coding to use Static Methods or normal instances, I prefer to use static if they where few but if there was many of them I start to get some doubts

[code]...

if the EmployeeManager Has Many methods (selects deletes updates) is it ok to make them all static.and if it was Normal instance. wouldn't be a drawback if the object is initiated every time specially if GetAllEmployees() is heavily used.What is the better approach to use?

View 3 Replies

Calling Private Shared Methods?

Aug 8, 2011

I have a form (frmMain) that contains a custom control (con class). frmMain contains a combo box control and when the user selects a value from it, I pass this value to a sub routine within con class (see red line below). This purpose of the sub routine is to populate a set of comboxes contained in con class according to the value that is passed in.

Private Sub cboGuidelines_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboGuidelines.SelectedIndexChanged
If bChanged = True Then

[code].....

View 6 Replies

Derived Class Shared Methods?

Nov 3, 2010

I have a function that 2 derived classes use, but the third doesn't, would it make sense to just leave it in the base class, even though one of the 3 derived classes doesn't use it?The only way I could think of disallowing the third class is to basically create an intermediate class that is derived of the base, then the 2 that use the common function are derived off the second class.

Is it possible to prevent the 3rd class from using the function, while letting the two that are supposed to use it, use it?Does that just seem to go overboard, I mean as long as I don't "try" to call the function from the 3rd class, it shouldn't be a problem, I just was interested if there was a way to prevent it all together without a lot of hassle.

View 2 Replies

OOP - Shared Methods And Base Properties?

Feb 25, 2009

If you can't use Me. in a non-instance method, how would you use properties/functions from a base class in a Shared method?

For example, ClassB inherits from ClassA
ClassB has a Shared Method DoWork();
ClassA has a ReadOnly Property SecurityKey

How do I Public Sub DoWork() Dim test as String = Me.SecurityKey End Sub

View 5 Replies

Shared Class With Generic Methods?

Jan 28, 2010

I have created a Interface and a couple classes that implement this Interface. I am in the process of developing a Shared Class that utilizes the functions that each of the individual classes have, due to the interface implementation.What i need to know is how do i develop this Shared Class so that way each of the methods within it are restricted to a single data type. This single data type needs to be restricted to any class that has implemented the Interface.

Some examples:

Public Interface IVector(Of T)
Sub Add(ByVal v2 as T)

[code]....

As you can see it would allow me to develop one form, since i have standardized the required Subs/Functions for any class the implements the IVector interface. As i am still in developement, i was wondering if my current understanding of the method generics is correct in its current form or what i would have to do to make the Generic Shared Class work in the fashion that i am looking for in the example implementation.

View 6 Replies

Subclassing Object With Shared Methods

Aug 3, 2009

I want to create a subclass of a class that has some shared methods. These shared methods all call one specific method. But I can't redefine that specific method in the subclass. If I try to make it overridable in the parent class, it says that shared and overridable can't both be used.

[Code]...

View 5 Replies

DB/Reporting :: Using SQL 2008 Express With A Multi User .NET Windows Application?

Mar 26, 2009

I'm using SQL 2008 Express with a multi user VB.NET Windows application. Do I have to add each user to the SQL user account? Does NT AuthoritySYSTEM work? I do not know how this works. So far I have NT AuthoritySYSTEM in the Security-Logins of the Server. But do I have to add it also in the database? In the databse Security-User, I have the following:

[Code]...

View 1 Replies

Provide Multi-language Support In My Windows Application Developed?

Jun 3, 2009

I M DEVELOPING AN ASP.NET APPLICATION I WANT TO PROVIDE INTERFACE IN ARABIC AND ENGLISH

View 2 Replies

Calling Shared Methods From .NET Class Library In VB6

Jan 25, 2010

I have the following class in a .NET class library:

Code:
Public Class JasonTest
Sub New()
End Sub

[Code]....

The .AddNumbers call works fine, but the AddStrings call yields the error 'Object doesn't support this property or method'.

Is there any way to call a shared method from .NET in VB6? I was unable to find any documentation on this.

View 5 Replies

Dynamic Assembly Loading And Using 'Shared' Methods?

Dec 20, 2011

I now have a need to dynamically load a dll into my application and I've found the reflection/assembly information and it's fairly easy to implement so I thought I was on my way. However, I quickly found out that I'm only able to use 'shared' methods. What I was originally thinking was I could have one shared method 'library.beginprocess' and then that would make all the necessary calls to the other methods, but this doesn't work unless all the other methods and class level objects are also shared.

I feel like I'm missing something or somethings just going right over my head. I've looked at many, many sites and examples, but I've only run across examples that expose 1 method,[URL]..which explain how to implement a plugin architechture, which I have not tried yet, but maybe would allow me to keep my class structure the same without having to make everything shared?

View 14 Replies

Overload Shared Methods On Non-instance Types Using Extensions?

May 14, 2012

I want to extend the BitConverter class with an overload of ToString() that takes a parameter of type Char, representing a value delimiter.Why? By default, the ToString() call returns a string representation of a byte array, delimited by dash symbols. The signature does not allow you to specify a different delimiter, which I find very unfortunate.Now because this is not an instance type, or maybe because I'm overloading a shared method, I'm having a hard time finding the proper syntax to define my extension method.What am I doing wrong here, causing the overloads to not show up in IntelliSense:

Imports System.Runtime.CompilerServices
Module BitConverterExtensions
<Extension()>

[code].....

View 1 Replies

Passing Parameters By Reference Into Public Shared Methods

Oct 21, 2009

I have a List(Of AddlInfo) with AddlInfo being an object. I'm trying to pass addlInfoList by reference into a function of another class:

[Code]...

This works if I'm not passing the reference into another class, but when I try to do this, I get the following error: Overload resolution failed because no accessible 'Sort' can be called with these arguments:

[Code]...

View 1 Replies

Purpose Of Using Shared Methods That Return An Instance Of A Class?

Oct 11, 2010

What is the purpose of using shared methods that return an instance of a class, as opposed to a constructor?

ie: in VB.net, the system.drawing.color class has shared method "FromArgb(int, int, int) as color". This is different from java's implementation which simply is a constructor that takes three ints. Why the decision to do one or the other?

View 1 Replies

Will Modifying Shared Methods Change The Class That Reference Them

Jun 4, 2011

I'm wondering what will actually change a class, in the sense that serialized objects of this class will no longer be recognized. If the class has reference to shared methods of another class. Will changing such shared methods also change the classes that reference them?

View 3 Replies

DB/Reporting :: Multi User - Windows Application With Back End As SQL Server 2008 Express

Mar 17, 2009

I'm working on a multi user VB.Net windows application with back end as SQL Server 2008 Express. The SQL Server is installed on the intranet network drive. This is the connection string I will be using. Is this correct?

Data Source=.SQLEXPRESS;AttachDbFilename=Q:DatabasePrintDB.mdf;Integrate d Security=True;Connect Timeout=30;User Instance=True

View 3 Replies

Mimic An Interface / Contract For Shared Methods In A Class For Use By Generics?

Nov 15, 2010

So I implemented my own form of Enum static classes so I can associate strings to enumeration values. One of the shared functions in each enum class, GetValue, is used to quickly look up the string value from an internal array via the offset. While all of the enum classes implement the same exact function, the data types of their parameters differ, specific to the enums in each class.

So I come to a point where I want to create a generic class that can use any of the enums by passing it as a generic type parameter. But I cannot find a way to constrain type T in such a way to be able to call each enum's GetValue function. This is where an interface would come in handy, but VB.NET forbids interfaces for shared methods.

I have a base class that I could constrain to, but the base class doesn't implement the GetValue method, and I can't define a generic version of it, because I need to rely on shared properties of each child class in order for GetValue to do its thing.[code]..

View 2 Replies

Passing Objects To Methods?

Jun 26, 2010

I always thought I understood how this works...but lately I have started really using interfaces and now things arent doing what I am expecting.

using entity framework, I have a service for each object that is responsible for interacting with the database and such....on my one service I am passing the collection of objects to my service as an icollection(of contactinfo) before I pass the object, the changetraker has the right states. however in my method, this is not the case and all states are set to unmodified.

Private Sub SaveExecute(ByVal param As Object)
Dim srv As Services.ContactInfoService = GetService(Of Services.IContactInfoService)()

[Code]....

As I said above the Me.contacInfoCollection has the right changetracking states. But Once its passed to the srv.savechanges it reverts to unmodified. I am sure its something silly I am missing...the whole EF thing can be confusing to me...

View 2 Replies

An Array Of Objects And Calling Their Methods?

Apr 19, 2009

I've been wasting so much time on this. Basically I want to have a list of objects and I want to call some specific methods of some specific bjects..g.MsgBox(Instances(0).Position(0).ToString)It should alert a number that presents the X position, but it is not working... the box does not even appear and no errors.

View 8 Replies

Calling Methods On Interop Objects - VB Vs C#

Apr 7, 2009

In C# I'm calling a function on an interop class (Connection, written in VB6), which itself returns a plain object (System). Then there's a function on that object (InitialiseData) that I also call (even though the compiler isn't aware of it). var isInitialised = Connection.System.InitialiseData(path); The problem is, because that System object is returning a mere Object, I get the compile error "cannot resolve symbol". I can see why, but the same thing works fine in VB.NET:

[Code]...

View 1 Replies

List Of Objects And Shared Events

Dec 8, 2010

Okay so I've created a list of objects from a class like

[Code]...

View 1 Replies

VS 2010 How To Create Methods For Objects Created At Runtime

Dec 26, 2010

If I create new textboxes, or any objects, based on user input, how can I create methods that use those new textboxes (objects). For instance,

[Code]...

View 2 Replies

Close Project And Open Another In Multi-Project Solutions?

Apr 11, 2012

I am developing a Multi-Project solution (A, B) in Visual Studio 2008.

I need to run a second project from the start up one and then the first project should be closed.

The matter is that I want to Exit the A.exe and kill the process and the dll that are depending on it. And then Run the B.exe.

View 4 Replies

Setup Of Windows Application Project?

Aug 4, 2011

i have made a window application programme in vb.net.i want to make a setup sothat it can easily install on another computer.plz help me....Pramod Gupta

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved