Declare A Variable To Be Shared By 2 Forms (classes) In The Same Project?

Jan 1, 2011

I've gone brain dead and can't remember how (where) to declare a variable to be shared by 2 forms (classes) in the same project.

View 2 Replies


ADVERTISEMENT

Create A Shared Project Wide Variable

Aug 3, 2010

I've been looking at using PROPERTIES [URL] but frankly I don't understand it that well. Before I invest the time to read, understand, and truly comprehend this, I want to make sure it's the best way. My intended goal is to create my database connection string in a function/sub somewhere, then assign it to this project wide string variable, then I can use it in any form, project wide without having to recreate it.

[Code]...

View 7 Replies

Way Of Hiding Forms And Classes From Main Project

Aug 31, 2009

the client has asked for all forms and classes to be hidden from the main project, so when he sells it, they will only be able to see part of the project and not all the classes and forms.My Solution: I have created another project called project2, and added all the forms and classes from main project, fixed all errors and compiled it.I deleted all the forms from the main project and added a reference so that it gets all the forms from the other project by referencing the dll file, but it does not seem to work and get a lot of errors.is there an easier way of hiding the forms and classes from the main project or do I need to do more then just add the reference.

View 2 Replies

How Often Do Professional Developers Use Multiple Forms/classes Per Project

Apr 6, 2010

I am in college taking computer programming and we are now in multiple classes and forms. It was very hard to get ahold of at first but now that I understand it a bit better I am curious as to how often in a professional enviornment do developers create multiple classes for a project? Besides the use of custom functions what else is beneficial for it?

View 4 Replies

Asp.net - Public Shared Variable Shared Between Users?

Mar 30, 2012

I've taken over the maintenance of the website (ASP.NET VB) and on one particular page I noticed the below code

Inherits System.Web.UI.Page
Public Shared UserNumber As String
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

[Code]....

My question is whether the variable UserNumber can be accessed or changed by any other user than the current one?

View 2 Replies

IDE :: Windows Forms Classes Appear As Class Modules Not Form Modules In Project Explorer

Jan 7, 2011

Yesterday I opened Visual Studio (2008 v 9.0.30729.1) and all the winform classes in my project display with class module icons with the little 'VB', instead of form module icons with the little form icon!

When I double click on a form module, the form designer doesn't open, just the code module.

When I run the project, it runs fine. There are no errors. The project builds fine.

I did Project --> show all files, and I can see the designer and resx files below the form module which doesn't look or act like a form module.

I can't open my forms to design them!

View 1 Replies

.net - Declare An Array Of Classes And Set Value?

Jun 7, 2012

I have a little syntax declare problem in VB.Net.

Dim proxy As USImportoerServiceTypeClient = DMRUtils.CreateAndConfigureClient()
Dim request As New USDeclare_I()
request.DeclareCollection = New US_ITypeDeclare() {}

[code]....

This above code do not work, becase the "US_ITypeDeclare() {}" is empty an only contains a new DeclareCollectionStructure

declare a KoeretoejErklaeringStructure to this an set this date value til "DeclareCollectionStructure.DeclareCollectionValidDate" ?

View 1 Replies

Declare The Name Space In Both The Classes?

Apr 8, 2010

I am new to .NET with Java back ground. Got a question on name space. I believe they are synonymous to Java packages concept.If I need two classes in the same name space do I have to declare the name space in both the classes?. Both classes are in different files E.g: If Class1 and Class2 need to be in Namespace myspace. Should it be

[Code]...

View 6 Replies

Declare An Array Of Classes In VB 2008?

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

Asp.net - How Are Classes Shared Between Projects In The Same Solution

Jan 29, 2011

Currently, I have a solution that contains two projects (ASP.net websites, FWIW). If I create a class in Project1, how do I expose it to Project2? Is it automatically available to Project2 because they are in the same solution? Or do I need to do something special to make the connection?

View 5 Replies

Shared (Static) Classes With Events In C#

Mar 27, 2010

[code]Now how do i do this in c#. I know there is not handles clause in c# so i need some function that is called and assign the event handlers there. However since its a shared class there is no constructor i must put it somewhere outside of a function.

View 2 Replies

Shared Events In Child Classes

Jul 7, 2011

I have a program with a base class and classes that inherit the base. A Windows Form will call a function of each child class which raises an event from the base class. The function call to the first child class works fine: the event is raised for the first child class.

[Code]...

View 7 Replies

Declare Main Class On FrmMain - Working With Classes?

Jun 3, 2009

Currently I declare my main class on frmMain. as public MyClass as new clsMyClass Thus anywhere in the application I would address it as: frmMain.MyClass.Function(MyParam) This does not look as neat as I would like it. Where can I load this Class so that I can address it as: MyClass.Function(MyParam) from anywhere inside the application.

View 6 Replies

IDE :: Declare A UserControl As MustInherit, And Then Use Its Child Classes In The Designer?

Aug 13, 2009

When attempting to create a UserControl type that must be inherited, when I try to edit one of its child classes in the Form Designer, I am not allowed to edit the child UserControl with the message:

To prevent possible data loss before loading the designer, the following errors must be resolved:
1 Error

The designer must create an instance of type "XX_ExpandContentsPanel2.IOCardMaster", but it cannot because the type is declared as abstract.

This error goes away if I remove the "MustInherit" restriction.Is there some way around this or do I just have to accept the (bonkers-mad) restriction, and not declare my class as as MustInherit, even though it's not a useful control in its own right?

View 2 Replies

.net - Access Shared Members In Partial Classes

Feb 16, 2011

I'm writing a WCF-Service and I split up my service class to multiple partial class files, so every ServiceContract-Implementation gets its own file. I have one file however that should contain e.g. members that are used by every partial class file such as a logger. The service is hosted with IIS 7 if this matters in any way.

[Code]....

The code compiles fine, but at runtime I get an BC30451: The name m_Log is not declared Error (Don't know the exact words for it. I get a german message ;) ). I don't think it has something to do with the type of m_Log or a depending assembly because I get the same error if i try this with a String. What am I doing wrong? How can I make this work? Edit: I was trying the same thing in a simple console application without any problems. :(

View 1 Replies

Asp.net - How To Get Classes To Expose The Same Shared/Static Method

Mar 4, 2010

I have a base class with several derived classes. I want all of my derived classes to have the same Public Shared (static) method with their own implementation. How do I do this? Is it even possible?

View 3 Replies

C# - ASP.NET's App_Code Folder And Shared/Static Classes?

May 15, 2011

If I have a 'Shared' object defined in the App_Code folder; is that object shared amongst all users/visitors of my website? Or is it shared on a per-user basis?I don't know if that makes sense or not; but I've got a puzzle/solver I'd written earlier that I'm trying to incorporate into a simple ASP.Net site. It's probably poorly written, but I'd used a Shared boolean to determine if a solution had been found. The code works, now as an ASP.NET site, but if two visitors to my site were both validating their puzzle at the same time, would they both be accessing the same boolean?

View 3 Replies

Extending Classes: Adding Shared Procedures?

Nov 2, 2009

is there anyway we could extend a shared function for a class? example:

<Extension()> Public Shared Function GetName(ByRef e As [Enum], ByVal value As Object) As String
Return [Enum].GetName(e.GetType, value)

[Code].....

however i dun hav a choice as Extension methods can be declared only within modules

View 21 Replies

Use Modules Instead Of Classes With Shared Member Functions?

May 19, 2009

Is it considered an acceptable practice to use Modules instead of Classes with Shared member functions in VB.Net?I tend to avoid Modules, because they feel like left over remains from VB6 and don't really seem to fit in anymore. On the other hand, there doesn't seem to be much difference between using a Module and a Class with only Shared members.

View 4 Replies

Declare A C# Variable Into An HTML Type Variable?

Dec 2, 2009

What's the C# equivalent of

<% dim name %>

so you can use it for web forms in PayPal API integration?

View 3 Replies

Declare A Variable For Instance Variable With Dim Not Private?

Feb 6, 2011

why don't we declare a variable for instance variable with dim not private?

View 3 Replies

VS 2005 Modules Vs Private Classes With Shared Members

Mar 28, 2011

I've read that modules are basically shared classes. For a module though, you can call a method directly without prefixing the module name. So I can do this: methodTest("abc", mod1Enum.enum2)But for a class with shared members I have to fully qualify the method call, and in this case fully qualify the enum:[code]In our conversion from VB6 to .NET the need to fully qualify all calls like this might be an argument for us to bring our VB6 modules over as modules instead of converting them to classes.

View 7 Replies

Create A "shared" Variable That Is Shared With All Instances Of A Class?

Jan 14, 2011

I seem to be drawing a blank. I'd like to create a "shared" variable that is shared with all instances of a class but not classes that inherit from it. For example.Class A: Shared list As New List(Of String): list.Add("A")

Class B Inherits A: list.Add("B")Class C Inherits B: list.Add("C")The end result I'd like is that any instance of A has just A in the list. Any instance of B has A and B in the list. Any instance of C has A, B, and C in the list. I can accomplish it by creating Instance variables, but I have to construct the list for each instance of a class. I'd like to construct it once for a specific point in the Hierarchy and then share it accross other instances of that class.

View 12 Replies

VS 2008 How To Declare Things From BLL Project In UI Project

Apr 26, 2009

i'm doing a program, and i'm working with a guy (he's kinda like a teacher) and he's teaching me tiered coding, UI, BLL and DAL.i've been taught to have the UI in one project, and the BLL in another, but they're in the same solution. pretty much i don't know how to declare things from the BLL project in the UI project.

View 1 Replies

Create A Generic Shared Class That Can Operate On Predefined Classes

Jan 27, 2010

I have an interface that i have declared some of the basic internal functions, subs, properties, etc. This interface is then implemented into 3 pre-defined classes. These classes are end-use classes so they dont get derived or inherited elsewhere. I am trying to create a generic shared class that can operate on each of these 3 predefined classes and potentially more as long as they implement the interface.

[Code]...

View 10 Replies

Declare One Variable More Than Once?

Jan 24, 2011

I want to know if it is possible to declare a variable thrice.

[code]...

View 1 Replies

Where To Declare Variable

Jul 21, 2009

I have a form with 2 controls, a textbox and a button. The user will type text into the textbox and then when they click the button the text that they entered will be added to a List Collection. You can see the code below. There is just 1 problem. Where would I put my declaration of my List Collection so that it holds the values and does not start at the first element everytime the button is clicked?[code]

View 5 Replies

Asp.net - Must Declare Scalar Variable?

Oct 21, 2011

I have been debugging my code for a while and looking at posts in other forums, but it seems to be that everyone has a different problem than mine and what works for them will not work for me.My dropdown list is supposed to filter a gridview by choosing all the Companies that are associated to a certain product. The solution I have found online is that most people did not have DataKeyNames set in their gridview. I do have this set, but not to CompanyID. It wouldn't make any sense. So I have no idea what I am supposed to do since this is the only answer I have found.

<asp:DropDownList ID="ddlCompany" runat="server" DataSourceID="dsCompanyFilter"
DataTextField="CompanyName" DataValueField="CompanyID" AppendDataBoundItems="true"
AutoPostBack="true">

[code]....

View 2 Replies

Declare A Variable As A Date?

Apr 1, 2009

How do you declare a variable as a Date and initialize it with a date before year 1. I would like to caluate historical BC dates using a fuction that returns the ellaspt time.

I've used this line of code however I can't to work setting the date value to a negative.

Dim
myDate As Date = CDate("2/6/1400")

View 2 Replies

Declare A Variable Calss With Dim?

Mar 18, 2011

why we can't declare a variable on some class such as math

for example?

dim s as new math

?

but we should imports them..

View 17 Replies







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