Getting Information From Non-shared Object?

Mar 9, 2011

I get an error when I declare an object NOT-shared in a subclass. I can not make this object (glNR) shared.Is there an other way?

[Code]...

View 5 Replies


ADVERTISEMENT

Creating A Shared Instance Of An Object?

Feb 13, 2012

I would like to create a global instance of a User Class that can be referenced by all the forms in my MDI application.This object may be set during the login procedure by the Login form but the user attributes are to be available for other forms. For example, MyUser.ID will be required for meeting the audit requirements whenever data is changed.

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

C# - Display Static (shared) Object's Properties In A PropertyGrid?

Apr 12, 2010

I would like to display static (shared) objects at runtime in a PropertyGrid but if I try to set the selected object property of the grid like this:

[Code]....

Is there a way to display a static (shared) object or the object's properties in the PropertyGrid?

View 1 Replies

Create A Private Shared Object In Each Class And Lock On That Instead?

Jul 13, 2009

I have created a synchronized queue and am using SyncLock on the SyncRoot property of that queue when I invoke the Enqueue/Dequeue methods. The methods are invoked from instances of standard producer/consumer classes.Is that a proper use of the SyncRoot property?

Would it be better practice to create a private shared object in each class and lock on that instead?

View 1 Replies

Shared - Understanding Access Modifiers In .Net With List ( Of Object)?

Mar 29, 2011

I've recently been updating a lot of my code to comply with proper n-tier architecture and OO programming, following examples from a book.I'm starting to get problems now because I don't fully understand the access modifiers.If I run the following code I get an error at the line

Dim clientFamilyDataAccessLayer As New ClientFamilyDAO

in the BLL at the point it creates an instance of the DAL. The full error message is: "The type initializer for 'ClientFamilyDAO' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object."

How do I use these function to create a list of ClientFamily objects that I can then work with?On my UI layer I'm creating a list of objects; ClientFamilies

Dim listOfClientFamilies As List(Of ClientFamily) = ClientFamily.GetClientFamiliesByKRM(selectedEmployee.StaffNumber)

This is the function in the BLL

Public Shared Function GetClientFamiliesByKRM(ByVal krmStaffNumber As Integer) As List(Of ClientFamily)
Dim clientFamilyDataAccessLayer As New ClientFamilyDAO
Return clientFamilyDataAccessLayer.GetClientFamiliesByKRM(krmStaffNumber)
End Function

and this is function in the DAL

Public Function GetClientFamiliesByKRM(ByVal staffNumber As Integer) As List(Of ClientFamily)
Dim currentConnection As SqlConnection = New SqlConnection(_connectionString)
Dim currentCommand As New SqlCommand

[code]....

View 1 Replies

Sql Server - Access A Shared Function From An Instance Of An Object?

Dec 28, 2010

The context of this question is that I am trying to debug performance issues (apart from the obvious ones I already know about and can find).I inherited a code base (VB.NET) for an ASP.NET app. This is an app that was developed way back in .NET 1.1 days, and was the first .NET app for a lot of the developers who worked on it.

In this code base is a class called DatabaseUtility that contains several Shared Public methods as well as non-Shared Public Functions and Subs for CRUD operations to the database (SQL Server).

It is common in my "BL" that a method creates an instance of the DatabaseUtility which essentially figures out what the connection string should be and opens a connection, as well as giving the developer a handle to the other methods contained within it.Dim utility as New DatabaseUtility()

Once I have that, I start to create parameters that I am going to pass to one of the methods in DatabaseUtility (like GetDataSet). There is a Shared method in my DatabaseUtility called CreateParameter which does essentially that. It creates a SqlParameter object so I can add it to a Parameters collection.

Now, the code base is littered with a lot of this:

utility.CreateParameter(...)However, because CreateParameter is a Shared method, I am not sure what is going on behind the scenes. I know because it is a Shared member that an instance of the DatabaseUtility is not created when I call it like this:DatabaseUtility.CreateParameter(...)

However, because I am calling it from an instance (utility), does that change the behavior at all?

View 1 Replies

VS 2008 Calling A Shared Member From A 'Type' Object

Jun 22, 2009

I'm not sure if I'm going mad, it's always a possibility. But is it possible to call a shared member of a class given its 'System.Type' object?

View 4 Replies

[2005] Pass Excel.Application Object To Shared-Addin By .Net?

Jan 22, 2009

I currently need to build a Automation Add-in for Excel. This add-in will load a recordset from Database to Excel. I would like to have function A() that I input in Cell as a formular. This function A() call a the add-in to load the data from Database to Excel. The data should be a matrix. So that means I would like to set in Excel worksheet a range of data by just calling single function in a cell. (I am sure there should be some way to implement it)As I know if I develop a shared Add-in by VB(or VB.Net) and in the add-in, I can get an Object of Excel.Application. By this Excel.Application object, I can get full control of Excel inside the Add-in. That means if I define a sub that load datamatrix from database and using the Excel.Application object I can populate the data matrix to the Excel.

I have done much research on internet and I now have built a shared Add-in for excel. I should say this add-in works fine without invoke the Excel.Application Object that I have tested. But when I call the Add-in function that invode Excel.Application Object from Excel I got an error as below:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Run-time error '2147467262'(*)
Unable to cast object of type 'System.String' to type Excel.Application

[code]....

View 2 Replies

Extract Information From The IDataReader Object?

Feb 16, 2012

I have two cases to extract information from the IDataReader object

Case - 1 - Length, calculates ordinal and then parse string

public static string GetString(IDataReader rdr, string columnName)
{
int ordinal = rdr.GetOrdinal(columnName);

[Code]....

Which technique should be preferred and why and if any specific context ?

View 3 Replies

Get Object Information In A Running Process?

Jul 9, 2010

I have a vb.net application which runs as a service. I also have another Windows application that serves as the service interface.In brief the service watches some folders for new files and imports them into various databases. In the service I have an class called 'importFile' containing basic properties such as 'FileName' and 'ImportStatus'. With each new incoming file I create a new instance of 'importFile' and add it to a list object called myFiles which is of the type: List (of importFile).Currently in my service im writing a few object details (such as ImportStatus) to an XML config file which is in turn read by the service interface application. I want to expose more information from the service to the interface, and communicating via xml doesn't feel like its the most efficient method.My question is how do I expose live objects, such as 'myFiles' in my service to my interface application? I think this can be done via the Process class but all my efforts have so far failed.I'm thinking that the solution may look something like the following, but im not too sure what im doing and could be way off:

View 1 Replies

Load Information From Several Different Tables Into A Game Object

Aug 15, 2009

The code I am having problems with is supposed to take a ID number and load the information from several different tables into a game object, then return the object. When it tries to load the data into the object I get an error saying there is no data in the row or column. [code]

View 2 Replies

Saving Object Location/Information On Forms?

Apr 12, 2011

I am making a program to organize grainbins in seperate yards.In this program, the grainbins need to be moved around and thier position to be saved when the program is closed. I also need to save information such as backcolour and text.I am specifically referring to GroupBoxes, OvalShapes, Textboxes, Labels, and ComboBoxes.

View 2 Replies

Could Not Get Column Information For Database Object Named 'COPYtblMHPuse'

Aug 11, 2009

I'm trying to develop an app to import a spreadsheet into an Access 97 database. I'm using Visual Studio 08. I'm stuck on the first step! I'm trying to use the Data Source Configuration Wizard to connect to the database, and when I get to the point where I choose which tables to add, I get the following error:

<COPYtblMHPuse>

Could not get column information for database object named 'COPYtblMHPuse' This is for any table I try to add.

View 1 Replies

.net - Do Classes Serialized As Object Lose Their Type Information

Apr 2, 2012

I have a serializable Message class that has a Data As Object property that I'm using as a generic holder for information to be sent via a system that uses a combination of push technology and/or IPC to communicate with any other programs that are interested in the information. This allows the communication piece to be agnostic of the information it transmits.

I was serializing this Data As Object as a Byte[], since I was worried about how an Object being serialized and transmitted across the network would behave on the other side. However, when deserializing I get errors about being unable to find the assembly for the types stored within my Data As Object property, because I'm deserializing in the assembly that contains the Message class... not the assembly that contains the type that Data As Object originally was.I was wondering if I'd lose the type information and be unable to cast it back to the type I want at the other end. Perhaps it's not possible to pass a type as an Object via another assembly without it knowing about my type?

View 2 Replies

Loops Through A Datareader And Saves The Information Into A Object Collection?

Nov 5, 2010

Basically I have a simple while loop that loops through a datareader and saves the information into a object collection. Later on in the code I have a simple function that loops through the collection and exports the data to excel. The later part works flawlessly.OK the issue is that for some strange issue If I just let the while loop work as it should it misses records in the datareader stream. Now it sounds crazy but if i add a counter (x=x+1) along with a message box at the end of the loop to tell me the value of the counter (msgbox(x)) it ALWAYS saves the correct amount of records. If I take the msgbox line out it ALWAYS misses records. I am so boggled right now.[code].....

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

Dynamic Way Of Loading The Information From The XML File Into A Specific Object Property?

Aug 11, 2010

I currently have a XML file for an application I am developing. I have built a a XMLFile.GetContent function to read my XML File and load the content into a set of specific objects. These objects are then added to a collection and passed back to the main code to be loaded into the memory of the application.I am looking for a dynamic way of loading the information from the XML file into a specific Object Property. I have added comments to the function to show what I want to make dynamic.Content of XML File

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Config>
<IQSDataSources>[code].....

View 2 Replies

Unable To Retrieve AplicationSettings Information (object Name, Property Name) For Connection?

Dec 5, 2006

I am faced with the prospect of having to completely rewrite the application.I have suddenly started to get this error message all the time - it seemed to start after I added a table to the schema, but deleting the table makes no difference. I can't see anything wrong with the connection string, but as it seems to be entirely undocumented, that doesn't mean much.

The connection string contains DataSource=.SQLEXPRESS;AttachDbFilename=|DataDirectory| est.mdf;Integrated Security=True;User Instance=Trueand certainly the string works when I use "test connection" from the application setting edit box. I am assuming that for some reason it is not evaluating the Data Directory , but can't see any reason why it shouldn't. Any ideas gratefully received! What might be a clue though is that I can't get rid of the table I added. I have deleted it from the database, deleted it from designer and saved the file, but it just keeps reapearing! Even when it is not showing, there is still a
table adapter in the .xsd file. I am reluctant to start editing this manually because of the danger of screwing something else up - I did try but it caused an error somewhere else (VS helpfully didn't say where)

View 1 Replies

Error, "Reference To A Non-shared Member Requires An Object Reference

Nov 28, 2010

I am receiving this error: Reference to a non-shared member requires an object reference on the code I've
bolded within the code body. Here is my code:

[Code]...

View 1 Replies

VS 2008 - Error : Reference To A Non-shared Member Requires An Object Reference

May 8, 2010

I get this error:Reference to a non-shared member requires an object reference.When i compile on the following code section:

Private Sub statusBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
ToolStripMenuItem.Checked = Not ToolStripMenuItem.Checked
statusStrip1.Visible = ToolStripMenuItem.Checked

View 1 Replies

VS2010 : Error: Reference To A Non-Shared Member Requires A Object Reference

Jun 20, 2011

when I do something like this: Process.Start [URL] it says that error only on Form2 not Form1.

View 2 Replies

Error 'Reference To A Non-shared Member Requires An Object Reference'

Jul 23, 2009

Error 'Reference to a non-shared member requires an object reference'?I want to know what a non-shared member is.

View 2 Replies

Error - Reference To A Non-shared Member Requires An Object Reference

Dec 7, 2010

I am opening frmB (variable for FormB - the actual form) from frmA. From btn1 I open frmB like this:

frmB = New FormB()
frmB.Show()

From btn2 (frmB is already open) I bring frmB to the front from behind frmA:

FormB.Show()
FormB.BringToFront().

No problem so far. Now I need to pass an arg to frmB. This is where I am having the problem.

from btn1 (in frmA) I do this:

frmB = New FormB(myArg) '--pass myArg to constructor of FormB -- no problem here
frmB.Show()

then from btn2 -- this is where I have the problem

FormB.Show()
FormB.BringToFront()

I tried placing myArg in FormB.Show(myArg) but that did not fix the problem. What is the correct way to pass myArg to FormB (frmB) in this scenario? Do I need to share FormB or frmB? How do I do this? "frmB" is frmA level variable.

View 5 Replies

Error : Reference To A Non-shared Member Requires An Object Reference

Sep 22, 2009

why i am getting an "reference to a non-shared member requires an object reference" error on format.Yesterday gets the previous days date and presents it in a yyyyMMdd format.vsettlementDates takes the "Yesterday value and requests data from it.

Dim Yesterday As String = format(Today.AddDays(-1), "yyyyMMdd")
Dim vSettlementDates As String = (Yesterday)

View 3 Replies

Error Reference To A Non-shared Member Requires An Object Reference

Apr 27, 2011

I am getting the following error:

Error 1 Reference to a non-shared member requires an object reference. (on WindowsIdentity.Groups)

Here's my code from that uses the WindowsIdentity.Groups property to display the identity references for the groups the current user belongs to. This code is part of a larger example provided for the WindowsIdentity class.

Public ReadOnly Property Groups As IdentityReferenceCollection
Get
Dim irc As IdentityReferenceCollection

[Code].....

View 1 Replies

Error Reference To A Non-shared Member Requires An Object Reference?

Dec 13, 2009

" GridView1.datasource = _MyUsers.Reference to a non-shared member requires an object reference." error. WHat's wrong with this code

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

[code]......

View 4 Replies

Error: Reference To A Non Shared Member Requires An Object Reference

Jul 22, 2011

I have the following code below, how the line where it says : For Each c As councillor In councillorList i get the error: reference to a non shared member requires an object reference. Can someone please advise where i am going wrong? [Code]

View 2 Replies

Error:Reference To A Non-shared Member Requires An Object Reference

Apr 6, 2012

Alright, so im getting this error:Reference to a non-shared member requires an object reference.This is the bit of code the error is pointing to:My.Settings.Bookmarks.Add(WebBrowser.Url.ToString)Why is it giving me this error?Its saying WebBrowser.Url is the problem.

View 1 Replies

Errors Reference To A Non-shared Member Requires An Object Reference

Aug 23, 2011

im sure it is something really simple. Im by no means comfortable with VB. The below code is not mine but i have altered it for my needs. However im getting a couple of errors.

Reference to a non-shared member requires an object reference. I have underlined the errors in the code and they all refer to the above description

[Code]...

View 1 Replies







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