Release Public Shared Variable After Form Close?

Mar 4, 2010

shared variables of particular form in vb.net 2005

View 1 Replies


ADVERTISEMENT

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

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

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

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

.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 Variable Not Delared In Other Form

Aug 9, 2010

I defined a variable in a form with

Then I want to check that variable in an other Form using[code]....

View 3 Replies

Create A Public Variable To Use On Any Form In The Application?

May 28, 2009

I have a query setup on the start form in my project - it looks for a user level (1 or 2 right now) I want to display/hide items on the form based on whether or not the user's permission (derived from this query) is a 1 or 2.

My question is, can i create a public variable out of this query to use on any form until the application is quit?

The query will be formatted something like this:

Dim
ssSQL As String = "SELECT UserLevel FROM [Employees] WHERE "
ssSQL &=

[Code].....

View 20 Replies

Get The Reference Of A Public Variable Using The String Name In Another Form?

Feb 25, 2011

I have public variables in a module. I need to get the reference of the variable by using the String name of variable in another formell me how to do this?I need something like the following code:

Dim Var1 As string
Dim sVariableName As String = "Var1"
GetReference(sVariableName).SetValue = "testing"

[code].....

View 2 Replies

Declare A Public Variable And A Public Sub In An Aspx Webpage?

Aug 26, 2010

How do declare a public variable .aspx web page that can be used in all the pages within my web application?

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

AXWindowsMediaPlayer Taking A Long Time To Release File On Close

Aug 29, 2011

I am writing an application for managing mp3 files. I use AXWindowsMediaPlayer1 for playing files and UltraID3 for reading and writing ID3 tags. Every time the user selects to switch to next song, the ID3 tags of the current file need to be updated. My problem is with Media Player taking a long time to release a file for access after doing a "close". Currently I need to add a 6 seconds delay between the "Close" method of the media player and the ID3 tag "Write", otherwise I get the error saying that the file is currently in use. Anything less than 6 seconds does not work...

I attached a short version of my application which focuses on the issue.

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

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

[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

VS 2005 Close A Shared Application?

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

What Is Different Between Global Variable And Public Variable

Jul 15, 2010

What is Different between global variable and public variable?

View 1 Replies

VS 2008 : Modal Form Hide Instead Of Close - Main Form Does Not Close

Mar 20, 2009

I have a main form that has a button with which a smaller form is shown. Think of the smaller form as the Find/Replace dialog in many applications, such as Notepad. It's important that the form is (what I believe is called) modal. What I mean is that it always stays on top of the main form. I ensure that by calling the Show method with "Me" as the owner argument. Whenever the small form loses focus it will not disappear into the background but stay visible (albeit out of focus). If you don't understand open up Notepad and have a look at the behavior of the Find/Replace dialog.

Here's my problem: instead of actually closing the form when the X is pressed, I want it to simply Hide itself, so its position and the state of any controls (checkboxes etc) is preserved automatically.To achieve this I simply cancel the FormClosing event and Hide it:

vb.net
Private Sub Form2_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

[code]....

To show the form, I use the following (note the (Me) to make the main form the owner of the form; this ensures that it remains visible even when it is out of focus):

vb.net
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show(Me)
End Sub

Now. When I run my project, and open the Form2 (small form), then hide it again (by 'closing' it), I can no longer close the main form (Form1)! It seems the main form cannot close when the small form still exists (albeit invisible)...?? When I don't use the Me argument in the Show method, I don't get the behavior I want. I know I can set the TopMost property to True but that will also cause it to become visible on top of all the other forms, even windows not part of my application.

View 8 Replies

Error: Public Member 'Close' On Type 'ApplicationClass' Not Found

May 7, 2012

I am having troubles figuring out why that line is throwing an error: MyExcel.Close(SaveChanges:=False)

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim MyExcel As New Excel.Application
MyExcel.Workbooks.Open("filename.xls")
MyExcel.Sheets("sheet1").activate()

[code]....

Error: Public member 'Close' on type 'ApplicationClass' not found.

View 2 Replies

Use Of Shared Variable In .net?

Mar 5, 2009

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

View 3 Replies

Difference Between Public Sub And Private Sub And Private Function And Public Function And Sub And Shared Function?

May 31, 2011

explain me the difference between them? I'm new to visual basic, and I need to know the very basic things in Visual Basic allowing me to become a professional User

View 8 Replies

Argument Not Specified For Parameter 'test' Of 'Public Shared Function TestThis(test As String)'?

Sep 25, 2010

I don't understand the error, Argument not specified for parameter 'test' of 'Public Shared Function TestThis(test As String)'.

Partial Public Class Form1
Shared Sub ReceiveCallback(ByVal ar As IAsyncResult)
Form1.Invoke(TestThis, New Object(){"test"}) 'error

[code].....

View 6 Replies







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