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


ADVERTISEMENT

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

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 Property' Not Working Properly?

May 24, 2009

I've defined a public property in a mdiParent form

Public Property StatusBar_LastChecked() As String
Get
Return Me.Statusbar1_LastChecked.Text[code]....

Now when I run the code, the msgbox shows the current text and then the new text. BUT the actual text in the StatusBar remains unchanged.

View 5 Replies

Basic Application(windows Forms) Doesn't Exit Properly After Navigating Through Forms

Jul 9, 2010

I have a basic three form application. It doesn't seem to close after navigating through forms. If I were to open the application, and the main form is displayed. If I press the X button, the application closes fine(Goes from processes) If I were to open the application, and then navigate from the main form to another form using me.hide & form1.show, and press the red X on Form1, the application again, closes fine.

[Code]...

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

Passing Data Between Forms Without Any Public Methods Or Properties On The Forms

Dec 28, 2009

Passing data between forms without any public methods or properties on the forms. everything but the "Controller" class, which I would like you furnish. I just changed the title from "Intermediate" to "Beginner" This solution is an example of the Observer Pattern. The "Controller" class is the "observed" class, which in this case means it publishes events.

' File Definitions.vb

Public Delegate Sub MessageDelegate(ByVal sender As Object, ByVal e As MessageEventArgs)

Public Class MessageEventArgs : Inherits EventArgs
Public Message As String

[CODE]...

The program should initially display Form1, and Form2. Clicking of the button on either form will modify the Title Text of both forms. I think that you will find the final end result to be pretty neat, as it works with any number of open forms not just two. I think asking for the Controller class is easier than asking for the code in the forms. My solution for Controller class has 7 lines of content, 9 lines if you include Class, EndClass. A minimal solution could achieved with only 4 lines of content, but it would a textbook example of bad programming.

View 12 Replies

Variable Not Capitalized Properly?

Feb 16, 2011

Dim SomeVariable as objectthen latter somevariable=1Now, in ancient time (vb2008), one way to know that I type the variable correctly is to see that the SomeVariable becomes capitalized properly. It's no longer is.

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

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

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

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

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

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

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

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

Release Public Shared Variable After Form Close?

Mar 4, 2010

shared variables of particular form in vb.net 2005

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

How To Close Forms Properly

Aug 23, 2010

I have couple of forms can be opened on the screen but how can close all forms properly when i click the "x" button from the main form?

View 1 Replies

Forms :: Bgcolor Not Working Properly?

Mar 27, 2009

I designed a software in which I used active captionas background colour. Now It works on my computer or current OS but not working properly onto other computers or OS. I mean to say that the background colour

View 1 Replies

Forms :: Tooltip In Checkbox Not Showing Properly

May 6, 2009

I added a tooltip control in my form and set a tooltip for a checkbox. The tooltip shows fine until I check the checkbox... If I check the checkbox once and uncheck it, the tooltip never shows up when I hover the mouse over it... How to make the tooltip to show on mousehover no matter the checkbox is clicked or not?

View 3 Replies







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