Shared Property Is Used For All Application Instances?
Mar 17, 2010
i have an multi-threading applicaton. so I am using system.threading.thread class to create thread. each threads call its own class and inside each class i am accessing webservices. I need to have status returned from each webservice. thats why I defined a shared property as list of generic object which will be updated within each class called its thread. but I have an hesitation that when I run application on the server. this shared object will be used by all instances of web application. Is it true or shared properties is used only for its own instance?
View 5 Replies
ADVERTISEMENT
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
Jan 24, 2011
VB.NET 2010, .NET 4. I am working on an application for controlling an industrial machine composed of many devices attached to the computer. Most if it is reasonable straight forward, but I'm having trouble thinking about the RS-232 devices. One of the RS-232 devices is a fancy power supply with many functions. The ones that are relevant right now are voltage read, voltage write, current read, and current write. The design pattern I'm trying to implement is one in which each attached device is represented by an object that has methods for reading/writing etc and properties for things like COM port etc.
For this power supply, clearly the Port reference should be shared among the instances, so I have a base class (say, PowerSupply) with a Protected Shared Property Port As IO.Ports.SerialPort. Then I have a couple classes that inherit from this class, PowerSupplyVoltage and PowerSupplyCurrent that each define read/write methods and properties for holding the last read/written values. My issue is in parsing the response from the power supply using the Port.DataRecieved event on the shared SerialPort object. The protocol the power supply uses specifies what data it's sending in each response packet.
So, basically, it might say something equivalent to "The voltage is 100V" or "The current is 1A" or "The voltage has been set to 150V" etc. I'm trying to parse this in a shared function. Only during the parsing process would I determine which instance's read/written value to update. I can't access the read/written value properties of the instances from within the shared function. The best I could think of is creating some kind of PowerSupplyCommunicator object that would maintain references to PowerSupplyVoltage and PowerSupplyCurrent instances along with the shared Port and DataRecievedHandler functions.
View 1 Replies
Jul 12, 2011
Which is the best way to store application and user settings of an application running with multiple instances?My problem is that using the vb's "Application Settings" one instance would overwrite the other one.I want to identify each instance with a number passed via command line argument. I could use this number to identify the appropriate settings of the running instance, but I see in a local INI o XML file a better way to handle that.
View 1 Replies
May 25, 2010
[using VB.NET, but I can easily read C# code in responses]I have a class called QuestionClipboard with ALL shared methods/properties. I previously had a QuesitonClipboard.doesClipboardHaveContent function that returned true/false if there was a Object on my 'clipboard'.I'd prefer to implement a Dependency Property so I can allow this true/false value to participate in data binding.The "GetValue(dp as DependencyProperty)" method requires an object instance, which would mean that my Property CAN'T be shared!Here is what the code would look like in my perfect world... Of course, the word "Shared" before the property declaration renders this code useless.
Private Shared clipboardHasContentPropertyKey As DependencyPropertyKey = DependencyProperty.RegisterReadOnly("clipboardHasContent", GetType(Boolean), GetType(QuestionClipboard), _
[code]....
View 1 Replies
Jan 12, 2011
I have a base class which defines a shared readonly property like this[code]...
View 5 Replies
May 24, 2010
Suppose I have a class of objects called Porky with a property called IsHuge:
Public Class Porky
Public Property IsHuge As Boolean
End Class
Now I want to make a special kind of Porky -- let's call it UberPorky -- for which I want to change ALL instances to either IsHuge or not IsHuge. What I'd like to do is this:
Public Class UberPorky
Inherits Porky
Public Overrides Shared Property IsHuge As Boolean
[code]....
The trouble is, I can't do that. I'm not allowed to reference MyBase or Me in a Shared property.
View 17 Replies
Jan 18, 2010
I have:
Page.aspx
Page.aspx.vb
TestClass.vb
I'm trying to access a shared property of the TestClass class from the Page.aspx.This code works fine:
<head>
<script language="JavaScript">
<% if System.Globalization.CultureInfo.CurrentCulture.Name.ToLower = "pt-br" Then %>[code]......
View 2 Replies
Aug 30, 2010
How can I check for multiple instances of my visual basic application? When the user runs the application, I want to know how many instances are already open.
View 2 Replies
Mar 9, 2009
I have an application which the user can open multiple instances on the same machine. However, a section of the app would have sync problems if more than 1 instance has control over it. This is where I thought of transferring control, or sharing, between them. What should I be looking into?
They would have to be able to identify which one of them has control and to send text information over. I thought IPC or Named Pipes could do the trick, but I'm unfamiliar with them and examples seem to indicate only a single server will work. Here, I have multiple instances of the same app and every one of them needs to be able to listen for that request for control.
View 25 Replies
Dec 7, 2011
i have a small prog to test the instances when i run another instance then i want to count it, ex. i open sample.exe this should be 1 in label and i open another instance of sample.exe this should be 2 in label how can i do this
i try this code but the instances count are not working
Dim count As Integer = My.Application.OpenForms.Count()
Label1.Text = count
View 9 Replies
Mar 20, 2010
I need to grab information between two instances of my WPF app (the contents of a public collection, to be precise).
View 2 Replies
Dec 11, 2009
I would like to be able to set Control visual properties such as color, boarder, flat style, etc. on the base class of the control so that as I add new instances of the control, each instance inherits the visual properties of the base. I have tried using Application Settings but it appears as though I need to reference an application setting manually each time I add the control to a form. This is a Windows Form question.
View 4 Replies
Aug 15, 2011
I made a simple "restarter" app... However, I need to close multiple instances of an application. For example, if I have three windows of paint, or three windows of Word open, how do I check if it is still open before I open a new instance?
[Code]...
View 1 Replies
Feb 20, 2011
I am having an applciation running in system tray notification area, but the problem is that although I exit the application the icon is still there, when I point my mouse near notification area it's gone as it should be when I clicked on exit. I guess it is because my mouse position makes the area to refresh, if so, how can I do it inside my application to avoid having my useless icon in there?
View 1 Replies
Dec 13, 2008
I have set the "Make single instance application" check box.And when my application version is 1.0.0.0 for example, it is OK and won't load multiple instances.But when I create a new version, for example 1.0.0.1, then I can run 2 instances of my application, when the 1st instance is 1.0.0.0 and the second instance is 1.0.0.1.What should I do to prevent this?
View 2 Replies
Jul 26, 2011
I am developing an application that has multiple forms and I wanted to know the best method to have application wide methods and functions. Currently I am using a Module with all my methods that are needed to be used across the entire application in it. However, I read at one point that modules should not be used, as they are only there to preserve backwards compatibility with older VB code. Is there a better way to have methods able to be called anywhere?
View 1 Replies
Jun 1, 2009
I've created an application that is on a shared drive and everyone can run it. I want to be able to close all the running instance of the application by sending it a command. How can I do that?
View 7 Replies
Jul 28, 2009
I have a VB2008 application that runs off a server. Users connect to the application via shortcut.
[code...]
For what it's worth, the application is targeting .NET 2.0 Framework on both the development side and package install side.
The illustration below is more for my sake than yours, but should help me explain the problem.
User A and B work just fine, but when User C and User D attempt to use the program via shortcut9(same as User A and B) the error below is displayed.
[code...]
what I can do to allow User C and D to use the application?
View 11 Replies
Jan 12, 2012
Basically i am creating a vbnet system software. I want to create a shortcut key to lock the system with out affecting the windows explorer (just my system only). Is it possible to create one for that? Or let's say create a procedure that triggers anywhere whether the focus is on a control, on a form (whether shown as normal or modal), or on any other that has the focus on it.
View 1 Replies
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
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
Apr 11, 2011
When i click on my installed VB.net application icon on the desktop,i receive the message : 'Application failed ti initialize property ox700000000000000 ..... click ok to terminate application'.
View 2 Replies
Jun 23, 2011
Have a VB.net application that installs initially from CD and then when the user gets into the internet the application updates. In order to better support problems with this application is has been suggested in the past to uninstall it and do a fresh re-install. However, in investigation it was determined that the uninstall does not consider all installed objects and does not uninstall the CD install.Can the uninstall functionality be modified to catch the other instances of this application and also uninstall them?
View 11 Replies
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
Aug 12, 2009
Given in the following language specification, for me at least, calling Db.Foobar() [In the following code] does not indeed call off to the Shared Constructors of the base classes. I am curious as to a) is this my own fault for doing something wrong or b) is this an error in the language specification[code]...
View 2 Replies
Nov 23, 2010
Have a windows application that "got complex" and new products could use many portions of the existing application.Decided to break app into multiple projects to facilitate sharing the appropriate pieces with new products.One object in app provides a library of text phrases used in the production of output docs.Wondering if such an object should be a set of shared methods instead of instantiating it in every object that consumes these text phrases.
View 5 Replies
Jun 4, 2010
I am trying to add shared members in derived classes and use that values in base classes...
I have base
class DBLayer
public shared function GetDetail(byval UIN as integer)
dim StrSql = string.format("select * from {0} where uin = {1}", tablename, uin)
end function
end class
[Code]..
currently there is error using the tablename variable of derived class in base class but i want to use it i dun know other techniques if other solutions are better then u can post it or u can say how can i make it work? confused...
View 2 Replies
May 27, 2009
Currently my Application.Info.Description is set to "".I'd like to change it to something else.The Description property is read only - is there a way that I can reset it?
View 2 Replies
May 22, 2012
The MSDN page for System.Windows.Application lists a property called StartupUri. However,this MSDN example uses Startup.Where is Startup defined? I couldn't find it in the MSDN documentation.
View 1 Replies