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


ADVERTISEMENT

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

Release Public Shared Variable After Form Close?

Mar 4, 2010

shared variables of particular form in vb.net 2005

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

What Is Different Between Global Variable And Public Variable

Jul 15, 2010

What is Different between global variable and public variable?

View 1 Replies

.net - Using A Class Like A Public Variable In Asp.net?

Apr 13, 2009

I'm getting an error in .net when trying to declare a Public class on my code behind page.

Partial Class _Default Inherits System.Web.UI.Page

Public someVariable as integer
Public someClass as className

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...]

The error I'm getting is BC30508: 'someClass' cannot expose type 'className' in namespace '<Default>' through class '_Default'.The goal here is accessing the class properties in script blocks on the aspx page like this <%=someClass.classProperty%>

I'm not sure if I'm trying the right methods (I've tried several ways of declaring the public class) or if it can even be done..

View 3 Replies

HOW To Declare A Public Variable

Apr 23, 2012

Later on i have a form where a cost for a class is calculated by timing the duration of a class by the costperhour textbox which is in a different form.

View 3 Replies

How To Reset Public Variable

Oct 28, 2009

I have few public Arrays variables, I need to reset them since I will be using them few times with different values.

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

Using Properties (rather Than A Public Variable)

Jan 19, 2010

Is there any point in using a property (rather than a public variable) if it just says:

[Code]...

View 1 Replies

Forms :: Properly Set A Public Variable?

Oct 31, 2010

I want al(InitialStrength.Text) to be set as the variable iST so I'm typing this at the top of the page before all my subs:

Public Class CharacterSheet
Public iST As Integer = Val(InitialStrength.Text)

[code]....

but every time I do that and try to compile without even using the variabe, I get this error: "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."

View 5 Replies

How To Call Variable In Public Class

Aug 22, 2011

I have this public class
Public Class commonSettings
Dim etcString As String = "some string"
End Class
How can I call etc String and use it entirely on my code?

View 3 Replies

Pass A Public Variable To A Sql Query?

Nov 4, 2010

I have a public variable that I declared in form1 of an application. I am trying to call that variable in form2 and then pass that variable in a sql query.

If I declare

Public Class Form1

Public payPeriodStartDate, payPeriodEndDate As Date

How then to I declare that variable in form2 and how to I pass it to my sql query

SELECT [Exceptions].Employeenumber,[Exceptions].exceptiondate, [Exceptions].starttime, [exceptions].endtime, [Exceptions].code, datediff(minute, starttime, endtime) as duration INTO ScratchPad2[code].....

View 13 Replies

Public Variable Goe Out Of Scope In Private Sub?

Aug 23, 2009

I have a public variable which seems to be going out of scope. I am confused as it has been dimensioned as a public variable: Public xlCell as As Microsoft.Office.Interop.Excel.Range

I originally had all my code in the same module in the same project and it was wrapped within a For/Next Loop (Example 1). I decided to clean up my code and make it more modular (Example 2). All the code is still in the same module in the same project.

Upon doing so, my public variable is not recognized in any of the private subs that I have created. I keep getting the following error: Message="Object reference not set to an instance of an object." When I test the variable using ?IsNothing(xlCell) in the Main Sub I get False in the main sub. this tells me te variable is recognized. However as soon as the Call SelectCaseSub() is triggered, I get a True value for ?IsNothing(xlCell). Why is this? Shouldn't this variable be in scope regardless?

[Code]...

View 6 Replies

Reassign Value For Public Long Variable .net?

May 3, 2012

When using the variable tTimeInterval as Long trying to reassign the variable in the timer's sub,

but the tTimeInterval is 0 after enter in the sub,,
Public tTimeInterval As Long Sub Main()'Dim param_obj(2) As Object 'param_obj(0) = "sdaddsa"
'Dim aThread1 As Thread = New Thread(AddressOf SendingMessage4)
'aThread1.Start(param_obj)tTimeInterval = 5000

[Code]...

View 1 Replies

Store A Variable As Public And Use Throughout Application?

May 28, 2009

I have a query that brings back a result that I want to be able to use on all forms in my project. Is there a way to store this until the application is terminated?

For example,

I'd like to store the result of this:

Dim ssSQL As String = "SELECT ClaimNo, Custodian, Activity, Code, DateStamp FROM [Activities] WHERE "
ssSQL &= "[ClaimNo] Like ('" & txtClaimNum.Text & "')"

[Code].....

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

Declare A Global (or Public?) Variable On Load?

Jun 13, 2012

Just working on getting more fluent in Visual Basic over the summer so I'm still sharp for my next visual basic class. My teacher went over variables, but only in local scope.I have looked everywhere, but I can't find exactly what I need. I'm making an alarm clock of sorts, and I have this code to populate the minute array and the hour array.

Public Class Form1
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code].....

View 3 Replies

Make A Variable Public To All Forms Within The Application?

Jun 9, 2011

how to make a variable public to all forms within the application.Eg

Public MyPath = "C:"

can do for one form but not all

View 3 Replies

Set The Value Of A Public Class Variable To A Text Box Entry?

Apr 1, 2010

how to set the value of a Public Class variable to a text box entry?

I have a variable declared in the Public Class that was assigned to a public variable and I want to be able to have user entry via textbox.

If i change the variable to an integer and set it to textbox my program wont build.

View 1 Replies

VS 2008 Using Public Readonly Variable In A Module

Nov 29, 2009

I have a public readonly variable in a module, but when I try to set it in my form load event for the first time I get 'ReadOnly' variable cannot be the target of an assignment. It is my understanding that a ReadOnly variable can only be set once and after that you would get an error when setting it.

View 2 Replies

VS 2008 Data In A Variable Not Transmitting Between Public Subs?

Nov 17, 2009

Basicly I have a set of public subs, (not related to a form), inside a public class, and all of them share a variable. One of the subs, the one called for first gives the variable a value.

When the next sub is called, the variable is null. The data in the variable has been erased as the execution of the prior public sub ended I'm guessing.

View 7 Replies

Private Read/Write Access And Public Readonly Access For Variable In Class?

Jan 12, 2012

Is it possible to set a variable in my custom class for Private Read/Write access and Public Readonly access without creating Properties with Get and Set? In other words, from within my class I want full access and from my form I only want read access. Right now I declare my variable as either Private or Public to control Public read/write access. I tried googling my question a bit but I'm not sure what the correct terms even ar

View 5 Replies

Unable To Use An Instance Of The Nested Class Through A Public Variable Of The Parent Class?

Jun 7, 2012

I want to created a nested class that can only be visible to and instantiated from the parent class.But I also want to be able to use an instance of the nested class through a public variable of the parent class.I tried making the nested class private, or making the nested class' constructor private, but it won't compile.Is it possible to do this in .NET?

[Code]...

View 3 Replies

VS 2008 Dynamically Declaring A Constant - Public Const Blah As String = Variable & "something"

Aug 5, 2009

How would I go about dynamically declaring a constant? (It's value is dynamic, not the variable name)

View 5 Replies

Pass A Variable To Another Form Or Else Make The Variable Visible To Both Forms?

Sep 5, 2010

Using Visual Basic 2008 Express. I need to pass a variable to another form. Or else make the variable visible to both forms.

View 4 Replies

Can't Use A Public Sub In Another Form

Aug 28, 2011

I can't use a public sub in another form...

Here is what I'm doing:

I created a button called BTest and a TextBox called TBTest.

When I press BTest, it writes on TBTest "BTest Worked!".

PS: The button BForm2 is just for Form's change.

Form 1
Public Class Form1
Private Sub BForm2_Click(ByVal sender As System.Object, ByVal e As

[Code]....

View 3 Replies

Run PUBLIC SUB From Another Form?

Jun 4, 2009

I have a couple of PUBLIC SUB's on my Form1. Is there a way that I can execute them on Form1 through another Form / Button-click? I am using a Dialog1.ShowDialog() for configuring some settings for my application. Now, I have most stuff on my Form1 set / loaded via PUBLIC SUB's (for example THEME SETTINGS, DROPDOWN LIST values and so on), and if I change something in the Dialog1 this Subs need to be executed again ...

Before my explanation gets too complicate, here a sample with a simple SUB:

Asume you have a Form1 with a Button1. On Button1Click a Dialog1.ShowDialog will be executed. In addition you have the following PUBLIC SUB on Form1:

Public Sub ShowMessage()
MessageBox.Show("Hello World!", "Message:", MessageBoxButtons.OK, MessageBoxIcon.Hand)
End Sub

How could I execute this Sub on Form1 from Dialog1 (maybe on a ButtonClick event)?

View 12 Replies

Pass Form Name To Public Sub?

Jan 14, 2012

My plan is depending on the users screen resolution a different form will open. Thats all fine and works hunky dory.

However, the form pulls code from a public sub and updates fields on the form based from the public sub[code]...

My problem is how can I change the FORM1024x768 to say FORM1366x768 if the users screen resolution determines a different form is chosen. I need something like[code]...

View 7 Replies







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