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


ADVERTISEMENT

Threading Class FrmMain To A Module And Modifying UI Thread Values?

Jan 15, 2010

In frmMain:

Private Sub DBReadAccountInfo(ByVal strAccountID As String)
Dim tmpaccountInfo As New PublicFunctions.clsAccountInfo
tmpAccountInfo.strAccountID = strAccountID
Dim ReadAccountInfo_Thread As New Thread(AddressOf tmpAccountInfo.DBLookupAccount)
ReadAccountInfo_Thread.IsBackground = True

[code]....

In "sub UpdateAccount", frmMain.InvokeRequired is always false. There's a MenuStrip control I'd like to update the .Text on.

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

.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

Ide - Ctrl-Break Suspends Code On "Partial Class FrmMain"?

Feb 1, 2012

This is an IDE question for VB Express 2008. It might be a bug in the IDE, or maybe it's my fault somehow?

My main form is named FrmMain and in my application's properties I have set frmMain as my startup object. All of that seems like what a lot of coders do.

But while debugging I hit Ctrl-Break, as I have done for years, and I get an behavior in the IDE that I wasn't expecting. Upon doing so, I get the green background text and the green arrow indicating in a tooltip: "This is the next statement to execute when this thread returns from the current function." Even if I didn't have the designer document open, it automatically opens frmMain.Designer.vb in the editor and hihglights line in green. The line is of course: Partial Class frmMain which is line 2 of the file. (Yes, it's highlighting the second line of the designer-generated code.)

The thing is, frmMain seems to have fully loaded and it's my startup object. As far as I know there shouldn't be a "next statement to execute" at all because code should be idle. I don't want to see the Designer.vb document... I want to edit my own code. Even though my form is behaving just fine, could there somehow be an unfinished aspect of loading the form such that it is "not returning" from a function?

Edit: In response to a couple comments, I'm adding three screen shots:

View 3 Replies

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

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

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

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

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

Inside The Service Class, Declare A Class Variable Named Started?

May 8, 2012

Create a class named Service. Inside the Service class, declare a class variable named Started. The datatype of this variable is Boolean.Public Class Service Dim started as Boolean End Class Create a class named Server. Inside the Server class, declare a dynamic array that can contain elements of the type Service.(Note: For convenience, both the array and the variable Started can be accessible from a client program that creates an instance of Server and Service respectively)

Create a constructor for the Service class. When the constructor is executed, it will set the value of the class variable Started to True. Create two new classes: WebServer and DatabaseEngine. Both of these classes inherit from the class Service. Inside the Service class, declare a Sub procedure (method) named Terminate. This method should display the following text Service stopping in a message box when executed.This method can be overridden in classes that inherit from Service class.

Inside both the WebServer and DatabaseEngine class, override the method Terminate inherited from their base class Service. Both methods should first call the base class Terminate method. The messages Web server stopping and Database engine stopping should also be displayed in a message box when the Terminate method for the WebServer and DatabaseEngine are called respectively. These messages should only be displayed if the Started variable inherited from their base class is not equal to False.

Inside the Server class, declare a method named Shutdown. This method does not return any value. When executed, it will call the Terminate method for each of the Service instances (if any) in the arrServices
array. You should call the Terminate method within a For Each loop that loops through the elements of the arrServices array.

In the Sub Main method, create an instance of the class Server. Set the size of the arrServices array in
your Server instance to contain 2 elements. Create first a WebServer instance and then a DatabaseEngine
instance into this array. Call the Shutdown method from your Server instance.

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

Declare A RANDOM Class Instance At CLASS Level?

May 6, 2010

If you run this code you will see that the 500 PictureBoxes that are added ( this is easier to show than adding pixels as a pixel is only a single point ) fall mainly on the diagonal.With regard the RANDOM class, why should this be like this when the bounds of the instances are? >>

p.Location = New Point(x.Next(0, Me.Width + 1
), y.Next(0, Me.Height + 1 ))
as in this code.>>

[code].....-2138214fdeb4

View 9 Replies

Declare An Internal Class Within A Public Class?

Nov 17, 2008

how to declare an internal class within a public class using vb.net?

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

Declare A Array Within Structure And It Is Not Working

Nov 15, 2011

I am trying to declare a array within a structure, and it is not working. [code] So I want each league to have a single name and id and 20 players.Is there a way other than writing out dim player1, player2 etc.

View 3 Replies

Working With Custom Classes?

Dec 16, 2010

I already know how to make really basic custom controls where I can pass in new variables to treenodes because of my custom class, but it's not really working out well for me.I figured out how to read the new values & change them while their in the normal treenode because oddly enough once i've passed in an object from my custom treenode class it worked but I want to know a few things.

1.With my custom class, I can't do things like the following.

MsgBox(
New
TreeNode("Today").IsSelected)

If I replace with CustomTreeNode it doesn't work no matter what I do even working with sub/new it always shows a default value instead of what value is, the most I can think of is because sub isn't returning value, but you can't return value in subs, how are you meant to make lines like that work?

2.Also anyways just for sake of having good intellisense & workings is there a way I can make a class of CustomTreeView that's using my CustomTreeNode's so that I can work on things by code in the EXACT same manor I used to given the name is the same but have my new custom values?Currently im stuck passing any changes using the new type & taking it out I type cast over to the custom type again so i can read the values, but I just want was wondering what I need to do to make it work like a real control would.

Anyways is there any way to over-ride the default control or something instead so I can simply add the new variables in there? I want the same functionality of the normal control just with the added variables so I can work with data pertaining to the nodes of each item in the treenode easier.I already used the Tag value to store some information but it's not like that there are 100 different variables to store information & it's not like anyone wants to store lots of values in 1 variable & parse out the one you need, it's possible but if I can create something good here, I want to use whatever I can make instead of taking my time on working on a more painfully difficult to work with, at least later when I might even need even more variables stored pertaining to each of the items.

View 7 Replies

Main Form And Subproblem With DLL Is Not Working

May 15, 2012

Now I am creating a software. It has 2 project.


Now I am calling mainform from WindowsStartForm-> SetupStartForm.vb file. This is the code

[Code]....

I have the problem is that in the messagebox it shows the incremented value. But no updations are there in the textbox of mainform. What is the reason for that.

View 2 Replies

Working With Data Organized By Classes

May 30, 2009

I am working in vb2008. How to store Class/Structure instance data into a database as single objects.
SomeClass
.name
.address
.age
.etc
Say I have a hundred instances of "SomeClass" stored with data. Is there a way that I can store each of my hundred instances as a hundred objects to a hundred Access database records. I am trying to avoid having to mirror my class structure into a datatable and treat each instance as a single object which can be stored into a single database column name.

View 6 Replies

Class Has Been Create By Main Class Only?

Feb 27, 2011

I'm try to create a class has been create by main class only by protect sub New but how do I create it ?

Public MustInherit Class Rune
Protected MustOverride Function Create() As Rune
Public Shared Function Factory(Of T As Rune)() As T
'I can't use "T As {Rune, New}" because Sub New isn't Public
'Return (New T).Create
End Function
End Class

[Code]...

View 2 Replies

Declare A Class As Friend Of Another In VB?

Jun 30, 2009

I have class Aand BHow do i declare the class B as a friend of A?

View 4 Replies

Declare A Class In Two Files?

Dec 12, 2011

Say some function is defined in one file and another function is defined in another file

In C++ you can do that right

View 2 Replies

Declare An Array As A Class?

Jun 21, 2010

I could have an array of players but I cant dim and array as new and my players are all a class I made called gameobject

View 4 Replies

Globally Declare A Class?

Jun 1, 2009

I know you can globally declare a structure so every class knows it.But I have a class named "WPNConnection", but I was wondering if you do like.Public WPN as new WPNConnection but so every class in the whole project could access it. It's just annoying having to raise events to get back to the class holding it, or finding the main class and finding it declared there.

View 2 Replies

Must Declare A 'Sub New' Because Its Base Class

Jul 17, 2010

I have a class library that have a lot of classes, in every class I have "Inherits LINQDataContext". And In my xx.designer.vb file I have...

Public Sub New()
MyBase.New(Global.My.MySettings.Default.DbConnectionString, mappingSource)
OnCreated()
End Sub

But I get a lot of "Class 'xxxxx' must declare a 'Sub New' because its base class 'LINQDataContext' has more than one accessible 'Sub New' that can be called with no arguments." errors

View 10 Replies

Trim Working Set When Main Form Loads?

Jan 10, 2010

I was wondering if there was a way to trim the working set when the main form loads in vb. I know in C# you can use
SetProcessWorkingSetSize(GetCurrentProcess, -1, -1) API call
But I am not quite sure how to implement this in vb. Basically I got an application that is showing 11,000K+ mem usage in the task manager when in actuality it is really only utilizing about 1,000K if that and I want to try and trim the working set to show the actual usage in the task manager rather than what the framework is reserving.

View 1 Replies

Working With An Instance Of A Dataset / Datatable From Other Classes

Apr 27, 2010

vs2010 vb.net QUESTION1 If i do a select and fill a datatable and want to access that data from another class. How can I do that? QUESTION1 example

[Code]...

View 1 Replies

Declare As A Sealed Class (non-inheritable)

Aug 16, 2010

How to declare this as a sealed class (non-inheritable) I used this in my main coding..

[Code]...

View 6 Replies







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