Public Variables Not Available In Module
Jan 17, 2011I have a variable declared at Public on a form. But when I try to access it in a module I get an error that its not declared.
[code]...
I have a variable declared at Public on a form. But when I try to access it in a module I get an error that its not declared.
[code]...
I have a VB .net application which works fine on a 32 bit systems. We tried using it on a 64bit Windows 7 system but it failed. So I set up an environment in a VM (windows 7 64bit VS 2005 SP1 all updated) and started debugging there. The problem I come across is, I have a module (Public variables and function declarations from a driver provider FTDI). When a function from module is called the result is saved in a variable also from module. But the problem is the variable is not declared.
View 1 RepliesI can access a module from code behind but not from the aspx page in inline VB code <% ... %>.
View 2 RepliesI'm converting a VB.net library to C# and having trouble finding the C# equivalent to a VB.Net Public Module.
In the same VB class is a With block. Any idea what the equivalent might be for that as well.
I have a situation where I have several VB.NET Modules in the same Logical-Module of a large application. I would like the update function of each module to be public, but I would like users to be forced to qualify the function call with the module name.
ModuleName.Update()
instead of
Update()
Is this possible?
I have a public module from which I want to use Form1 components. How do I do that? For example:
Module Print_to_textbox1()
what goes here for me to display a message into a textbox1 on Form1?
End Module
Im new in this forum. I just recently upgraded my Visual Studio 2003 to Visual Studio 2008.I have a web project which is working very well in Visual Studio 2003. But when Im trying to run the same project in Visual Studio 2008, Im getting a runtime error message.The error message is about a public function which is defined in a public module. When Im trying to call that function from different web pages of my project, the web pages are not recognising the public functions and asking me to
View 3 RepliesI'm working on a project for my VB class at school. I am creating a form with several inputs and it calculates the total amount owed for a car sale. I have a text box for input of the TRADE IN VALUE of a car. the program is looking for a numeric input. If there is no trade in, how can i get this box to default to 0.00 so it doesnt error the program?
View 2 RepliesI 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 RepliesI wrote a public modules for Insert, Update, Delete for SQL but I want to write public module for show any record on For example
"Listview or ComboBox or DataGrideView" by one module I mean When I create a new Form in vb I don't want to write All Command for each form to show record
Public Sub ShowRecord(ByVal TabelName As String, ?)
If SqlCon.State = ConnectionState.Open Then SqlCon.Close()
Try
[code]....
How to Fill this Space marked by question Mark?
i want to add BindingNavigator at run time to which i made a public method in module.vb, and want to run buttons withEvnets on it
View 1 RepliesI am using VB2008 In the Form1, i have coded
Public Function getText(ByRef ctlName As String) As String
getText = Mfg.get_TextMatrix(Mfg.Row,Mfg.Col
[Code]...
Can one client call a public property within a VB.NET module and see the value of that public property changed by another client accessing it at the same time?
[Code].....
I'm running into random instances where it looks like another client might be modifying (by setting) the value of GetSetDateTime DURING the first client's run through of WhateverMethod(). This is alarming to me and I've been trying to figure out if that's a possibility.
I am writing a control application for an inteface card. The complicated work of initialising communication with the card is written and working fine. However, my problem is to update the text in a dialog label on the communication interface form from a module that contains all the coding for accessing the inteface card. From the module, the interface dll returns data that describes some typical connection errors and the module then calls on Public Subs in the form to display error messages; for example:This is the Public Sub in the Module that initiates communication with the interface card:
Public Sub OpenDeviceInterface()
DeviceID = 1 - My.Resources.DeviceID
h = OpenDevice(DeviceID)
Select Case h
Case 0, 1, 2, 3
[code]....
What happens when these Public subs are called from the module is that the MSgBoxes I made to test the routine show up but the label text doesn't appear.I've tried; Refresh, on the label and the form without success...
if it is possible to place the openfileDialog in public class or module? i tried to place it with this code, but it did not work.
Public Sub DisplayDataOnGrid(ByVal gridTable As DataGridView)
Dim filepath As String
Dim OpenExcelFile As New OpenFileDialog()
[Code]....
i am working on the MSDN tutorials through virtual labs and am encountering a problem with the very first tutorial regarding consoles. I am required to create two notepad files: Module HelloWorld & Public Class Person which I have done without errors having triple checked them. When the files are created I compile the HelloWorld.vb file and a .exe is created
I follow the rest of the steps and encounter an error when i try to compile the Person.vb file using the line vbc Person.vb/t:library/out:HelloWorldLib.dll as i am getting the following errors:
vbc : Command line error BC2001 : file 'HelloWorld.vb/t:library/out:HelloWorldLib.dll' could not be found
vbc : Command line error BC2008 : no input sources specified
I've created a 30 point wizard. Every step gathers between 1 and 3 variables. I've created a module and publicly declared the variables there. At the end of the wizard, one master form opens, gets all the variables, and displays them on one form. At this point calculations are run too which populates more variables. This works fine for one instance of the process.
the user may want to be running two instances of the wizard at once. Obviously, if the previous wizard is part complete and they start a new one, the variables are going to get crossed or replaced by the new wizard.Is there a way for the variables to be declared publicly but used in multiple instances?
I declare a variable as FRIEND in a Module. Then I instantiate that variable in a Sub in the Module. After the Sub runs, when I try to access that Variable, it is always NULL (Nothing).
Module MODULE_Main
Friend MyClass1 As Class1
Friend Sub Main()
[code]....
How do I get MyClass1 to persist, meaning how do I get access to that variable outside of the Sub that instantiates it?
I have a string on my main form called String1. When I open another form, I need access to this value. In the form I open, I have always done something like:Dim NewString as String = Main.String1
This has worked in the past. Well, I ended up renaming my forms (from Form1 to Main) in the property window and it now when I type the above code, it does not list Main as a form. Nothing that I renamed seems to exist now.
recently started converting our project from 1.1 to 2.0
It was fine with the following:
Public ghtAllAppMsgs As New Hashtable(300)
Now it is complaining to change to the following is this the right way:
Public ghtAllAppMsgs As New System.Collections.Hashtable(300)
This is under global.vb class file: here are the imports i already had in this file:
Imports Microsoft.Web.UI.WebControls
Imports Microsoft.Web.UI.WebControls.MultiPage
Imports System.Web
[Code]......
This seems basic but here's my problem. I am trying to build my connect string as a public variable that will connect to either an express version of SQL Server or a non-express version. The app.config defines it as being express or not and is modified to the user's choosing when it is deployed using the a firstRun routine.
The problem is that even though I'm modifying the value of the variable SQLexpress when the app is initiated which in turn should modify the value of the variable g_strConnectionString it doesn't. The value of g_strConnectionString will always take on the initial value of SQLexpress. I know I can define 2 separate variables for the connection string but I'd prefer not to have to change all of the references throughout each of the various programs in this system as they all have the same issue.
So in the following load event I've traced it and when it sets globals.SQLexpress = "", I then look at the value of g_strConnectionString and it still contains "SQLEXPRESS". It seems I need to somehow force vb to refresh this variable after it's been changed.
[Code]...
I am a little new to .NET Developing, and have learned a great deal recently, but I'm stuck with something. I come from an ASP Background, I'm trying to subtract 2 variables, but they don't seem to 'see' one another.
[Code]...
I have a MDI application and a very complicated class there which populates its properties from a dataset derived from an external database. Each form, including child forms have to be able to access that class and use its properties thorughout the whole session.I don't know where to 'preserve' these property values within the application. I kmow many books etc. suggest not to use public variables but I really can't find a way to solve this other than to use a public variable (which is a list(of my custom class) in this case.
I have a separate class called PublicItems.vb and declared there my public variable as
Public Shared secuniverse As List(Of myCustomClass)Is there something wrong with the syntax because if I try to use the variable secuniverse in my main application class, I get the following exception:'sectoruniverse' is not declared. It may be inaccessible due to its protection level.
I am new to the forum and new to the visual studio set up and have been working at a practical at home and have ran into some difficulty. The notes say that I am to declare several module variables below the section entitledI have the rest of the form complete but have been unable to locate where I am to place this code
View 1 RepliesI am using this example I found to learn how to load class files and access variables through them. This is in a file called Class1.vb in the App_Code folder (this is not an app project):
Imports Microsoft.VisualBasic
Public Class my_class
Public Shared Sub my_sub()
[Code]....
How could I access the vartest variable without using a session, since if this is accessed by multiple functions at the same time the variable can be overwritten I assume. Is it possible to go the other way, where a variable is sent to a class file?
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 RepliesI am currently working on a project of "interpreting" C# into VB. The project involves adding images to a database, retrieving images from the database and presenting them in thumbnails. Right now I have the following Public Class with the Variable that needs to be assigned:
VB:
Imports System.Data
Imports System.Drawing
Imports System.IO
[code]....
When and why do you declare variables in the Public Class Form1 section?
View 1 RepliesI'm writing a new app and copying/pasting some lines from another one. In the new app, I get error when I use variables defined as public.
[Code]....
I have a bunch of private variables I've typed out and I want to put all of my corresponding Public ReadOnly Properties in a bunch below them.Is there some way of copying ten lines of
Private _myVar As String
and pasting in ten sets of
Public Readonly Property MyVar As String
Get
Return _myVar[code]....
I'm currently copying the whole bunch of variable declarations, Find+Replacing Private _ into Public ReadOnly Property then going line-by-line expanding the definitions and writing return statements.how to avoid all this nonsense in the future, as I'm developing on a virtual terminal server, and the input lag on my little copy/paste/type operations on the code is driving me up the wall.