Asp.net - Public Shared Variable Shared Between Users?

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


ADVERTISEMENT

.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

Public Shared Variable Ref?

Jun 29, 2011

I have an arraylist in a user form (Mainform) that I would like to be able to share among multiple forms and edit the contents. Using the Public Shared method I have been able to view and even edit the arraylist, but it does not seem to be changing it back on the main form. I can give more detail if needed.

View 9 Replies

Accessing A Public Shared Variable From A Different Class?

Jan 10, 2012

I currently have two forms, and I need to share the value of a variable in one of them.

I declared the variable to be 'Public Shared', and assigned a value to it. However,

when I inspect the value it appears as 'Nothing'. Here is the snippet:

Public Class A
Public Shared sVar As String = Nothing
Private Sub A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code]....

View 4 Replies

Release Public Shared Variable After Form Close?

Mar 4, 2010

shared variables of particular form in vb.net 2005

View 1 Replies

Create A "shared" Variable That Is Shared With All Instances Of A Class?

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

Asp.net - Access A Module Or A Public Class With Public Shared Members From Inline Vb Code <% .. %>?

Feb 10, 2011

I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.

View 2 Replies

Public Shared Function Continued?

Aug 6, 2009

I made the changes from this:

[code]...

to this:(the 'End Function' says "Function 'GetFolderPath' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used."

[code]...

View 4 Replies

Public Shared MyVariable As String?

Jun 21, 2011

Say I have an ASP solution with a Globals.vb file. Inside that file, I have this: Public Shared MyVariable As String Now say I publish this solution and make it available to Bob and Cindy.If Cindy sets (through the interface) MyVariable to 5, would Bob be able to read it? I hope not, I'm hoping this variable would be user-specific.

View 2 Replies

Accessing Public Shared Function From Another Form

Mar 1, 2011

[Code]...

i have a function that i have in my data access class now i want to access it then declare and assign parameters and then insert data into database.

View 4 Replies

Accessing Variables From A Public Shared Subroutine?

Feb 15, 2009

I have created a public shared subroutine in a class file in asp.net 2 (vb.net) web site app_folder.The subroutine retrives some values from a sql database via an sql query and assigns the datareader field values to several variables The problem is I can't seem to assign the variables from the subroutine to the variables and textbox controls in the asp.net page I am calling the subroutine from. The textbox text value just appear blank.By the way, if I response.write the variables in the subroutine they appear populated by the sql data reader.

View 9 Replies

Public Shared SqlConnection - Used In Multiple Functions

Jan 29, 2010

I have an asp.net web app. It has a shared class, and I want to have the connection string the same through out the site. My string is in my web config, but I don't want to type this all over the place:

View 3 Replies

[2008] Find A Folder That Is Shared Between All Users Of A PC

Mar 9, 2010

I need to find a folder that is shared between all users of a PC, every body being able to read/write to that folder and below, without any errors. I think that the folder "C:Documents and SettingsAll UsersShared Folder" would do the trick. How do I find the path to that folder, regardless of the OS used (Xp / Vista / 7) and regardless of the Windows language (With a french Windows, this folder is called "C:Documents and SettingsAll UsersDocuments partag").

View 5 Replies

Difference Between A Private, Public, Shared Functions/Sub/Variables?

Jul 22, 2009

give me a good resource that explains the difference between a Private, Public, Shared Functions/Sub/Variables? I normally use Public for Subs/Functions inside of Modules I call from other parts of the program. But I'd like to get more of an understanding of how and when to use them. I want as little as impact to a system that is running my programs as possible, so i guess the key here is I'm trying to just get more proficient in my coding.

View 8 Replies

Override A Public Shared Method In Derived Class?

Oct 8, 2010

Can we override a Public Shared method in derived class? If not why?

View 2 Replies

Passing Parameters By Reference Into Public Shared Methods

Oct 21, 2009

I have a List(Of AddlInfo) with AddlInfo being an object. I'm trying to pass addlInfoList by reference into a function of another class:

[Code]...

This works if I'm not passing the reference into another class, but when I try to do this, I get the following error: Overload resolution failed because no accessible 'Sort' can be called with these arguments:

[Code]...

View 1 Replies

Too Many Arguments For Public Shared Create Auto-CompleteItem?

Mar 1, 2012

I didn't write the function for the AutoCompleteExtender so I am not quite sure how to change it without screwing it up, so I figured I would ask here. Recently, it was requested that the AutoComplete show a product name & the date of launch of that specific product. I do not know how to add the date to the AutoComplete.

View 1 Replies

Developing An Access Database That Will Be Shared With Multiple Users?

Aug 22, 2008

I am developing an access database that will be shared with multiple users.I don't want the users to access the database directly so I will have them enter new data on a data access page. The data access page is stored on a Microsoft Share Point web page, and the database is stored on a network drive.Here is my problem: When new data is entered on the web page I need it to trigger a WillChangeRecordset event; however, I have not been successful because the web page does not declare a new instance of a recordset object.At a minimum I need the new data to be processed before the web page appends the new data to the table.

View 3 Replies

Shared Method Not Calling Shared Constructor

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

[2005] SyncLock And Multithreading - Public Class Utilities With A Many Shared Functions

Feb 11, 2009

I am trying to get a handle on SyncLock and multithreading, but I am having some trouble wrapping my head around exactly how it should be implemented. I have a Public Class Utilities with a many Shared Functions. I want to make sure that each function can only be executed when there are no other concurrent calls to the same function. So If I have 2 functions, A and B in a Public Class Utilities, what is the syntax so that a function "locks" while it is being executed, preventing any subsequent calls until the "locking" thread has completed?

CODE

Public Class Utilities

Public Shared Function A (ByRef i As Integer) As Integer

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

I know I need to wrap the statements of execution in a SyncLock block, but I am unsure of the scope of the parameter used with SyncLock...is it private to the function, class, etc? Can the same object be used to lock both functions if they are independent?

View 36 Replies

VB - How To Use Dll - Project Class Library, Named It MyFirstDll And Made A Public Shared Sub HelloDll

Apr 21, 2012

I am just testing how to use dll and after googling a lot, I made it work partially...Created new project Class Library, named it myFirstDll and made a Public Shared Sub helloDll to do something. Now since this is my first time, the dll is simply showing the input in a msgbox:

Public Shared Sub helloDll(ByVal msg As String)

If msg <> "" Then
MsgBox(msg, MsgBoxStyle.OkOnly, "WE HAVE SOME MSG")
Else
MsgBox(msg, MsgBoxStyle.OkOnly, "NO MSG")
End If

End Sub

After building the dll-file, I started a new project using normal windows forms, named it "useMyDll", I clicked Project -> Add Reference, and added my dll. The program file that I made needed a textbox and a button for using the dll:

Private Sub useDllButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles useDllButton1.Click
Dim msg As String = Nothing
msg = TextBox1.Text
myFirstDll.myFirstDLL.helloDll(msg) 'this will be in msgbox in dll-file
End Sub

And when running this I could write something in the textbox and a msgbox with that input would pop up. Really happy with that. My first attempt to make a dll and use it was very successful. Then I thought, what about running the dll from rundll32.exe? It would be handy to make a dll that could be run without my exe. After googling a long time, I tried to add a new button:

Private Sub useDllButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles useDllButton2.Click
'Now let us see if we can open it using rundll32.exe ?
Dim msg As String = Nothing
msg = TextBox1.Text

[CODE]...

Now the first button still works just fine, but the second button gives some error (translated to english would be) like "missing entry: helloDll" I also tried to open with command prompt, same result.

After googling again I read one place that you can't run a visual basic dll with rundll32.exe, so is this true? Or is there some way of doing it? I read one place that it works if you make the dll be "COM-Visible", but I don't really understand how to or what it means. I tried to open properties, clicked Assembly Information, and "Make assembly COM-Visible", but this doesn't change anything. Then I read somewhere that it has to be in a module to work. Could it be that I need to rewrite some codes and it would work, or would I have to start learning c++ in order to accomplish this?

View 13 Replies

Use Of Shared Variable In .net?

Mar 5, 2009

What is the use of shared variable in vb.net?

View 3 Replies

C# - Shared / Static Variable Should Be Nothing?

Jan 6, 2011

I have the following code:
Public Class TestClass
Public Sub Main()
If theGlobal IsNot Nothing Then Throw New Exception("What gives!")
End Sub
Private Shared theGlobal As Object = Nothing
[Code] .....
Why is theGlobal object NOT Nothing?

View 2 Replies

How To Dispose Shared Variable

Apr 12, 2011

How to dispose the shared variable in vb.net.i am using shared object of Asterisk.NET Manager Variable, i assigned it in form load and i dispose it in main form closing, My problem is after closing the application, application.exe keeps live in task manager, if i not initializing the shared object in form load there is no problem,[code]

View 3 Replies

.net - ASP.NET Shared Variable For An Error Handler

May 28, 2012

I am planning to use a shared variable to implement a logging facility. Have a look at the code below:

Imports System.IO
Public Class TestClass
Public Shared objError As New StreamWriter("C:Test.txt")
End Class

[Code]....

I think I have found my answer here: [URL] "A static variable continues to exist and retains its most recent value. The next time your code calls the procedure, the variable is not reinitialized, and it still holds the latest value that you assigned to it. A static variable continues to exist for the lifetime of the class or module that it is defined in."

I am not convinced that this is the best way to create a logging facility.

View 2 Replies

C# - Does Session Variable Shared Across Different Browser

May 24, 2012

Does session variable shared accross different browser? If not is there away that I can share information accross browser similar to the functionality of caching but the scope is wider.

View 3 Replies

How Many Instance Will A Shared Variable Be Created

Apr 7, 2010

How many instances of a shared variable will be created in a class? just one? correct

[code]...

So, in other words, the DocumentDelivery class will only have one instance of RenderList, correct? can somebody confirm?

View 3 Replies

Shared Variable For Multiple Loading

Jul 22, 2011

I need some tips for shared variable to share the information for multiple running application. For example, the value of variable become 1 when a user run the first instance(execution), and become 2 when the user executes the second(in sames OS or through network).

View 3 Replies

Create A Shared Project Wide Variable

Aug 3, 2010

I've been looking at using PROPERTIES [URL] but frankly I don't understand it that well. Before I invest the time to read, understand, and truly comprehend this, I want to make sure it's the best way. My intended goal is to create my database connection string in a function/sub somewhere, then assign it to this project wide string variable, then I can use it in any form, project wide without having to recreate it.

[Code]...

View 7 Replies

IDE :: Checking Shared Variable Values During Debugging?

Feb 20, 2009

I have declared a class in VB.NET using VS2K5 with some shared variables and made that class a dllI made use of that dll in another project and tried to make use of those variables. Even though I can able to make use of them, Im unable to view the values of those variables like the values of normal variables when Im debugging. Is there any way that I can watch the values of those shared variables during debugging.

View 1 Replies







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