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


ADVERTISEMENT

Provide Db Scalar Methods In All Classes?

Mar 5, 2009

We build a class (i.e. Server) and create a LOAD method that loads a dataset with all the details of that object.We need all that information sometimes... but what about when we only need one piece of data from that object (i.e. webserviceUrl).Should we build classes with a bunch of scalar methods that get back single pieces of data as opposed to only getting ALL the data and then only taking what we need?It's a waste to get all the data when we dont always need all of it but it also will take longer to write the extra methods..

View 2 Replies

Provide An Error Message If The User Does Not Provide A Value In Textbox?

Mar 30, 2010

How can I provide an error message if the user does not provide a value in my textbox. I found this example, but it doesn't work in my

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e_
As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then

[code]....

It says that Error Provider1 is not declared. How do I do this the right way?

View 4 Replies

Calling The Classes To Be Used In The Main Form?

Apr 3, 2012

I have an original assignment that works fine, now I need to go back and make it into classes. I am not 100% how to do this. My issues are with calling the classes to be used in the main form, and what to put into the classes.

I will post the original working assignment and my understanding of the classes.

[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

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

VS 2010 Make Classes Import Into Main Form.vb

Mar 20, 2012

I was just wondering how you can make classes import into your main Form.vb

Let's say I make a class with the following.

Public Class OtherStuff
Public Sub HideMe()
Form1.Hide()

[Code]....

How could I make the Form1.vb include the things that are in OtherStuff.vb.

All of the solutions that I have tried come up with the same error. Reference to a non-shared member requires an object reference.

View 2 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

Main Differences Between Properties And Variables?

Jun 25, 2011

Why use simple properties instead of fields in C#?

If I have a class, does it matter if I use a Variable instead of a Property? I mean, unless I need something to run during the get/set time period, does it really matter?

View 1 Replies

Sub Main() With WinApp Messes With Variables?

Jan 8, 2011

I'm having some problems with a Windows Application where I have deselected the application framework to be able to use Sub Main().I want to use Sub Main() because then I can do some things without showing any graphic interface to the user. Things such as automatic update and checking if another instance of the application is running.After checking these things, I execute these lines to run my application:

vb.net Dim frmMain As New frmMain() Application.Run(frmMain)

I need to run it this way or else the application will close when Sub Main() ends. The Application.Run keeps the application alive until I exit the main thread.However, this causes some problems with a variable, no information can be saved into it, I don't know if it affects any other variables as I haven't noticed it. However, I save a string to the variable and then when trying to compare it, the variable is string.empty.Could it be Application.Run which is messing things up? Should I do frmMain.Show() and keep the application running with some sort of WaitUntilExit?

View 3 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

Sub Main In A Project-static And Global Variables

May 17, 2009

I try to create a sub main in a project but i can not.I have create a module called Module 1 and inside i have created a Main Sub which is intended to creta a thesaurus_form class instance , like this Code: Module module 1Public Sub Main()Dim thesaurus_form2= New Thesaurus_formEnd SubEnd module.Instead of this, once it has cretaed a first instance of the thesaurus_form class, it creates another one what i dont want at all..How can i do do make it execute the code which is inside the thesaurus_form_load sub..I also can not create a global variable or a staitc variable, because i receive this message.static is not valid in a member variable declaration.

View 2 Replies

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

VS 2008 - Bunch Of Errors - Main Login Box And Then Fail To Show The Main Screen

Jul 28, 2009

My app works fine on the development machine and 3 other machines. However, some machines just show the main login box and then fail to show the main screen. There is no error message. I installed VS 2008 express on on of such machines and when i compile the project, the following errors appear:

Type 'Microsoft.Office.Interop.Access.Application' is not defined.
Type 'dao.DBEngine' is not defined.

[CODE]..........................

View 3 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 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

VS 2010 Calling Subs And Functions Within Classes That Are Within Classes?

Oct 24, 2009

Here is some example code of what I mean:

vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click

[Code]....

View 5 Replies

Provide URL In A Toolstrip?

Aug 21, 2009

Provide URL in a toolstrip? I mean to URL that will be displayed as a link.

View 4 Replies

.net - Provide Access To This Custom DAL?

May 13, 2010

I'm writing a custom DAL (VB.NET) for an ordering system project. I'd like to explain how it is coded now, and receive some alternate ideas to make coding against the DAL easier/more readable. The DAL is part of an n-tier (not n-layer) application, where each tier is in it's own assembly/DLL.

The DAL consists of several classes that have specific behavior. For instance, there is an Order class that is responsible for retrieving and saving orders. Most of the classes have only two methods, a "Get" and a "Save," with multiple overloads for each. These classes are marked as Friend and are only visible to the DAL (which is in it's own assembly).

In most cases, the DAL returns what I will call a "Data Object." This object is a class that contains only data and validation, and is located in a common assembly that both the BLL and DAL can read.To provide public access to the DAL, I currently have a static (module) class that has many shared members. A simplified version looks something like this:

Public Class DAL
Private Sub New
End Sub
Public Shared Function GetOrder(OrderID as String) as OrderData

[code].....

This cleans it up a bit, but it leaves a lot of classes that only have references to other classes, which I don't like for some reason.Without resorting to passing DB specific instructions (like where clauses) from BLL to DAL, what is the best or most common practice for providing a single point of access for the DAL?

View 2 Replies

Provide Only Delete Key In Propertygrid?

Jun 16, 2009

In my propertygrid having one custom property ..suppose some text is there in this item.i want user to allow only delete the item.nothing more like editing ,backspace nothing..only provide delete key option to this property item..

View 4 Replies

Derived Classes Cannot Raise Base Classes

Jul 10, 2009

I m trying to raise Click event of Textbox explictly but I m getting "Derived classes cannot raise base classes" error.[code]....

View 1 Replies

Forms :: Order To Provide In Listbox?

Aug 26, 2010

i have a problem and my project is stop now so i must solve this problem i have a listbox in my project and simple is; so this infos are irregular. i getting this infos with a loop into listbox. i want this infos be sub-bottom.

View 2 Replies

Provide Textbox In Time Format?

Nov 14, 2010

I want to provide a textbox in my windows forms application (in vb.net) that will be masked in time format and validate for time in 12hr format. It should also auto complete i.e if user enters 6 and clicks tab then it should make the text to 6:00 am.

View 3 Replies

C# - Provide A Readonly Collection That Implements INotifyCollectionChanged?

Jul 28, 2010

Is there a efficient way to provide an Enumarable<SomeType> or a collection that implements INotifyCollectionChanged but that can only be changed from the inside of the providing class.

The following example shows what I mean, but has the disadvantage that the caller can cast the IEnumerable<SomeType> back and then manipulate my internal collection, what I really would dislike:

[Code]...

View 2 Replies

Designer Loader Did Not Provide A Root Component?

Jan 11, 2010

When I build my VB.NET 2008 Express Edition project I get the following error

The designer loader did not provide a root domponent but has not indicated why

I though this meant that I need to put my Acces mdb in the root folder of the project but that didn't help. why I'm getting this error? If I click on more information I get an message saying information not found.

View 2 Replies

How To Provide User Control With Wide Data

Nov 23, 2010

I want to make a user control (name MultiSelect), which I will use for choosing items from huge list. For example I want to choose customers to make a view of their turnovers, so I will creat a new MultiSelect control which will contain a textbox (i canwrite starting letters) and a treeview (will list customers matching the first letters chosen in textbox).

View 7 Replies

On Form Load Want To Provide User With 3 Options?

Nov 12, 2011

creating a simple pong type game. want to provide human user option to choose from "rookie , Veteran, Allstar" as CPU AI skill.

Q1 - currently on form load game starts (I do not want) I want to present list of options first. Player Skill Level *See above.

Q2 - Want to provide an option for who gets the ball first CPU or Human

Q3 - Want to choose "Game to #" the user can set as the first to score x points wins.

View 6 Replies

Provide An Effective Way For Application To Get Registered Automatically?

Apr 30, 2009

I would like to provide an effective way for my VB.NET application to get registered automatically in a company with many computers. So the Enterprise Licence would kick in, but how to manage this?I was thinking each computer would connect to an intranet server where he would get the permission to register...C64

View 2 Replies







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