Losing Class Variables - Use Classes More In My Programs

Sep 24, 2010

I'm trying to use classes more in my programs. I'm using classes. This is the section of the main form that is causing the problem:

If conType = Nothing Then
TaOrIbt()
End If
objGetECaptureType.CaptureType(conType)

[CODE]...

View 12 Replies


ADVERTISEMENT

Losing Session Variables When Loging In With IE?

Jun 10, 2009

I am trying to fix an ASP.NET application that is also written is VB and uses session variables to store the information from the logging page. In Firefox, the application runs just fine, but in IE (I am using IE 8), when I summit the logging credentials, the session variables become empty (takes me back to the logging pageThe weird thing is that when I move the privacy settings in IE (doesn't matter if high to low, or low to high) and enter the logging information again, the runs great. Also if I restart IIS 6.0 the application runs great. What's going on?

View 5 Replies

Build A Class Or A Part Of A Program That Can Be Add Into Other Programs To Be Used In That Programs?

May 27, 2011

I am sure this can be done, as Visual Studio is basically built this way. What I want to do is simply make a class that my other workmates can use. But rather than have it in a code form, I want to build it (partially), and then my workmate can add it into their programs (sort of, like the add reference for the .NET stuff).

View 4 Replies

Asp.net - Server.Transfer Losing Local Variables?

Oct 26, 2011

For my application, I have a page that redirects to another page (within the same application) via Server.Transfer. I need to do this because the original page has an object that I need to access by using the Page.PreviousPage property.

Once my "destination" page has been fully loaded, a local deep clone that I made of the source page's object is suddenly released from memory once I perform a postback? Is this by design--something to do with the Server.Transfer?

Page1.aspx:
Public Structure myCustomObject
Implements ICloneable
Dim someField as String = "default value" ' Default value

[code]....

At this point, EVERYTHING works as it should. Stuff got cloned over correctly and all is well.(Let's say this is on a button click event) Debug.Write(newObj.someField) ' Output: "default value"<- This is NOT "changed value from source page" for some reason when it was working literally a few lines ago! My guess is that the Server.Transfer stops any association with the source page after the new page loads.

View 1 Replies

Server.Transfer Losing Local Variables?

May 24, 2010

I have a page that redirects to another page (within the same application) via Server.Transfer. I need to do this because the original page has an object that I need to access by using the Page.PreviousPage property

View 1 Replies

VS 2010 Structure Classes So That The User Interfaces Though A Single Class While The Supporting Classes Are Hidden From Their View?

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

Find Out Other Classes/control Handles For Different Programs?

Mar 25, 2010

In all the sendmessage examples its always to Notepad using the class "edit" how would i find out other classes/control handles for different programs?

[Code]...

View 11 Replies

How To Find Out Other Classes / Control Handles For Different Programs

Mar 25, 2010

In all the sendmessage examples its always to Notepad using the class "edit" how would i find out other classes/control handles for different programs? [code]I'm just testing this on mozilla firefox for now, but it doesnt send over the Virtual Key because i cant find the Hwnd.

View 2 Replies

VS 2005 - How To Make Custom Base Classes Available To Future Programs

Oct 22, 2010

I have written multiple programs in the past that deal with cad data. Points, lines, arcs, etc. For each program I ended up creating slightly different versions of some really base classes like a class that defines a point:

<Serializable()> Public Class Point
Public x As Double = 0
Public y As Double = 0
Public z As Double = 0
End Class

My question is how would I use that class in such a way that it could be in a namespace and imported into any future project that I write?

View 2 Replies

Define Some Global Variables Of A Class - Variables Occupy Memory?

Mar 23, 2012

I define some global variables of a class as follows:

Private Class MyClass
Private var1 as Decimal
Private list1 as List(Of string)[code].....

But I found that after this form is closed, all above variables, var1, list1, list2 still exist in memory. I thought they should be collected by gc since the form is already disposed as I confirmed.

Add: I have monitored half an hour after the form is closed. But these variables are not collected by gc. I have an automatic update procedure on the form which uses above variables.Since the above variables still hold values, the automatic update procedure is always called which causes exception. (One quick fix is to check if form.isDisposed in update procedure. But I do not think this is elegeant. Besides, these variables occupy memory.)

View 2 Replies

Create A Simple Page That Displays Information From VB Programs Variables?

Apr 13, 2011

I have created a program that takes a users input of a bunch of fields. Now what i want to do is create a word document using the information that was entered so users can print a page with the information and save it as well.

View 1 Replies

Use Variables Or Properties, And Global Or Static Variables In A Class?

Jun 9, 2012

I'm new in .NET programming.I have a class Form1 that includes Button1_Click event.Button1_Click creates a multiple Text Boxies at run time)Here is the class:

Public Class Form1
Dim shiftDown As Integer
Dim counter As Integer

[code].....

View 3 Replies

Grouping Variables Within Classes?

Sep 8, 2009

I have a class called Trigger. within this class, I can perform a variety of functions, the main of which is to monitor a specific condition. In this class I have a bunch of class variables that are used to setup the condition as well as for information purposes after the condition has executed. All the conditions are stored in a database and when I start the program, I create a New Trigger class for each condition and store the variables (name, desc, action to perform once the condition is met, etc.) I was thinking about changing the class to create a Structure called Configuration where I would store all the variables. But then I would have to save the Configuration within the class so it could be used later on if needed correct?

[Code]...

but in looking at this i realized that I am creating a new structure and then creating a new trigger class where I am saving the Configuration structure which essentially seems the same as just using class variables as I was before. I also looked at creating a Configuration Class and a Trigger Class. then from the main class I would create all the Configurations and have a shared Trigger class that monitored all of them instead of having a single Trigger class for each Configuration. Using this method i could create a hash table that kept track of each configuration that was being monitored and stop it if required.

Does either method sound more appropriate over the other. I am just trying to understand when/why to do things a certain way.

View 4 Replies

Passing Variables Through Classes?

Feb 8, 2012

I'm having trouble passing Variable information through classes, here is what I mean.

Example:
On my Form I call on Test.Result
Test is my Class

[code].....

View 1 Replies

Provide Variables From Main To All Other Classes?

Oct 18, 2009

I have a need to provide mouse coordinates and click details to the sub-classes of an application. The details are stored in a typed variable in the main class, as they are not processed when the event occurs.

What is the correct way of getting the classes to refer to variables in the parent class that instigated them? I realise this is not standard practise, but at this stage in the project I am converting code from a procedural language and need to do this as an intermediary step. Using the mouse events is also not possible, as this is a DirectX-oriented real-time program, and some things still have to be processed procedurally. They have to be stored via the event and then processed manually.

I may have dozens of instances of the classes, so distributing the mouse data every time it changes is not a good option. Ideally, the class should be able to retrieve the data when it needs it.

View 2 Replies

Suppress Private Variables In .NET Classes?

Feb 28, 2010

Does anyone know how to supress the private variables from showing in the .NET Namespace? I have a Class that looks similar to this.

[Code]...

View 5 Replies

VS 2010 Public Variables For All Classes?

Mar 30, 2011

I have a MDI application and a very complicated class there which populates its properties from a dataset derived from an external database. Each form, including child forms have to be able to access that class and use its properties thorughout the whole session.I don't know where to 'preserve' these property values within the application. I kmow many books etc. suggest not to use public variables but I really can't find a way to solve this other than to use a public variable (which is a list(of my custom class) in this case.
I have a separate class called PublicItems.vb and declared there my public variable as

Public Shared secuniverse As List(Of myCustomClass)Is there something wrong with the syntax because if I try to use the variable secuniverse in my main application class, I get the following exception:'sectoruniverse' is not declared. It may be inaccessible due to its protection level.

View 7 Replies

Get A Value Inside Parent Class From Child Class (in Nested Classes)?

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

Class - .net Interface And A Classes?

Mar 25, 2012

I have a class which has a variety of details, as follows:

Vehicle Name
Vehicle Address
VEHICLE Percentage: 10

I need to somehow use an Interface for another version, SpecialVehicle.

Special Vehicle has a different Percentage, for example 15.

How can I integrate that in an interface? I just don't understand them?

View 1 Replies

Best Pratice In Inheritance - Three Classes Employee, Manager And Salesman. Manager And Salesman Classes Inherits Employee Class

Jul 27, 2010

I have three classes Employee, Manager and Salesman. Manager and Salesman classes inherits Employee class.

Employee :

Public MustInherit Class Employee
' Field data.
Protected empName As String
Protected empID As Integer
Protected currPay As Single

[CODE]...

Manager :

Public Class Manager
Inherits Employee

[CODE]...

Salesman :

Public Class Salesman
Inherits Employee

[CODE]...

Now I have created a object of salesman and manager using the following code:

Dim objSalesMan as Employee=new Salesman("xyz",1,2000,5000)
Dim objManager as Employee=new Manager("abx",2,5000,"production")

Is this a good programming pratice or should I use:

Dim objSalesMan as new Salesman("xyz",1,2000,5000)
Dim objManager as new Manager("abx",2,5000,"production")

View 6 Replies

.net - Inner Classes Building XML - Have Outer Class Put It Together?

Feb 25, 2011

I am trying to create a class whose end result is do create an XML document. Currently the class consists of nested classes that each build a section of the XML document. What I am hung up on is how I should tie the results of the inner classes for the final output.Should the outer class pass an instance of XmlTextWriter to each of the inner classes that build up specific sections or should each innerclass just output a string representation of the XML and the outer class can piece them together?

[code]...

The code is not complete but I hope it gives an idea of what I am trying to accomplish. I need to find a way to gather XML sections together to output as a single document.

View 3 Replies

.net - Monitoring All Events In A Class And Sub-classes

Apr 25, 2010

I'd like to be able to log to the console every time an event is fired either in the object I've instantiated or in anything it's instantiated [ad infinitum]. I wouldn't see some of these events normally due to them being consumed further down the chain). Ideally I would be able to log all public and private events but if only public are possible, I can live with that.

I've Googled and all I can find is how to monitor a directory - So I'm not sure if this is not possible or simply has a name that I don't know.

The sort of information I'm after is similar to what's found in an exception - Target Site, Source, Stack Trace, etc...

Could I perhaps do this through reflection somehow?

To Give you an idea of the console App:

Sub Main()
Container = ContainerGenerate.GenerateContainer()
Dim TemplateID As New Guid("5959b961-b347-46bc-b1b6-cba311304f43")

[Code]....

View 2 Replies

Class Project Developing Classes?

Apr 15, 2012

I'm working on a class project where I have to create an item class with private attributes, public get and set methods for the attributes, and two non-access methods. I have two textbooks I work with. The first book is Clearly Visual Basic(Zak) and the second is Programming, Logic, and Design(Farrel). I've set my private attributes but I am having difficulty writing what I want to accomplish in the VB.net language.

Class CD1
Declarations
private string cdName
private string aristName

[code]....

View 14 Replies

Class SELF That Is Hosted By A Couple Different Classes?

Jan 16, 2010

I have a class SELF that is hosted by a couple different classes. Basically, the hosting class HOST calls a method in SELF. SELF is passed HOST as an argument in the constructor, so SELF can call methods in HOST. In normal situations, a call to HOST will do something minor, then return so that SELF can continue. However, for one particular type of HOST, one of the calls from SELF to HOST will cause HOST to call SELF, and so on ad infinitum. A classic, though convoluted, case of recursion. Once again, this is only going to happen for one type of HOST. For other types of HOST, that particular call will not cause HOST to call SELF, so there will be no recursion. Nonetheless, there is no getting around it in one case.

I can see two means to decouple the recursion, and I am wondering which one (or a third) would work best:

1) Add a timer into that particular HOST so that the call from SELF that would trigger the recursion would actually just start the timer in HOST, then return. When the timer ticks, HOST can call SELF. The recursion is broken because the call to SELF is done on the timer event, and not when SELF called HOST.

2) As it happens, HOST makes the first call to SELF in a background thread, which means I don't really need to worry whether this thread blocks or not. Therefore, I could have this background thread spawn a second background thread to make the call to SELF, then have the initial HOST thread JOIN on the second thread. This means that the initial thread will block until the second thread finishes. Meanwhile, the second thread will call HOST, and the HOST won't call back to SELF, it will just return like all the other HOST objects would do. This will allow the second thread to run to completion. When the second thread completes, the first thread will take over and call SELF again on a new second thread. Therefore, the recursion is broken because the secondary thread will always run to completion, and the primary thread will wait for the secondary thread to complete, then call it again.

I tend to prefer the second option, because the first option involves a pause of some length (the minimum for a timer, which is pretty small), while the second doesn't, but the first option is actually a little easier to implement.

View 6 Replies

Creating A Class That Contains Other Classes/Objects?

Aug 27, 2010

I'm wondering on how you would go abouts instantiating a class that contains other complex objects. for example an Payment Class which has Date,Time, etc.. and it also holds a reference to a paymethod object which has id,Type,Description etc.. How do you instantiate the payment class with all the other objects without one or the other failing, how do you create the payment class which doesn

View 4 Replies

.net :: Convert C# Classes (class Library) To SQL DDL (tables)?

Aug 4, 2010

I have to convert a set of C# classes (class library) to SQL tables to be used by SQL Server, so that the data can be stored in a database and manipulated through the database.The problem is that the number of these classes is big (more than 1000 classes),and it would take a long time to setup manually such a database schema (tables,ndexes, stored procedures, etc.) - not to mention the class hierarchies that I need to maintain.

View 6 Replies

Call & Use A Classes Type From Methods Within The Class?

Mar 3, 2011

I will preface this by saying Im previously an asp developer and am learning oop programming/Vb.Net

Im working on a 3 tier architecture and trying to abstract my code as much as possible since I have a very large intranet to convert. In my business layer I am defining my classes with management methods. Below is an example of one of my classes.

My question: Is there a way for me to genericaly refer to the class type and object type so that I dont have to continualy refer to the class name/type "ServiceRequest" throughout the class. For example something like:

[Code]...

View 1 Replies

Create Multiple Classes Of Different Names That Use That Class?

Mar 6, 2009

Okay, say I have a class named "ChannelList", and it raises an event named "FoundChannel"

But what I'M wanting to do is create multiple classes of different names that use that class, but I want to have all of the "FoundChannel" events be handled under one single sub routine?

View 15 Replies

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

VS 2008 Reference The Same Instance Of A Class From Different Classes?

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







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