How To Reset Public Variable
Oct 28, 2009I have few public Arrays variables, I need to reset them since I will be using them few times with different values.
View 3 RepliesI have few public Arrays variables, I need to reset them since I will be using them few times with different values.
View 3 RepliesHow do declare a public variable .aspx web page that can be used in all the pages within my web application?
View 3 RepliesWhat is Different between global variable and public variable?
View 1 RepliesI'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..
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 RepliesI 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 RepliesIs there any point in using a property (rather than a public variable) if it just says:
[Code]...
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."
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?
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].....
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]...
I defined a variable in a form with
Then I want to check that variable in an other Form using[code]....
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]...
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].....
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]....
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].....
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].....
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].....
how to make a variable public to all forms within the application.Eg
Public MyPath = "C:"
can do for one form but not all
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.
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 Repliesshared variables of particular form in vb.net 2005
View 1 RepliesBasicly 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.
I got on my form textboxes, checboxes but also a groupbox which holds texboxes.
The idea is to be able to clear and reset all of these by clicking a reset button.
At the moment i got this
Private Sub ClearFields()
Dim ctrl As Control
[Code].....
But ofc Me.controls isn't gonna get involved with the stuff in the groupbox.
Ok, so I am building my own program to control a video player I have through telnet, I have everything else working except one thing.I have a reset button to reset the player, when I press it, it sends the string "Reset" and the unit resets without a problem.But when I add a code to close the winsock connection upon reset, it doesn't send the string to the unit. I am sure what is happening is the winsock is getting closed at the exact same time it is trying to send the string and so it fails to send, how do I make it close winsock AFTER the string has been sent? [code]
View 1 RepliesIs 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 RepliesI 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]...
How would I go about dynamically declaring a constant? (It's value is dynamic, not the variable name)
View 5 RepliesI can access a module from code behind but not from the aspx page in inline VB code <% ... %>.
View 2 RepliesI'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?