Hello,
I am using Visual Web Developer 2005 Express. I want to declare a varible,
using Visual Basic as the language and can't get anywhere. For example
Public Test1 as String
I'll get en error saying to change Public to Dim. When I do, it will say
that Test1 is an unused local variable.
Thanks for any help.
God Bless,
Mark A. Sam 6 3517
"Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message
news:eJ******** ******@TK2MSFTN GP10.phx.gbl... Hello,
I am using Visual Web Developer 2005 Express. I want to declare a varible, using Visual Basic as the language and can't get anywhere. For example
Public Test1 as String
I'll get en error saying to change Public to Dim. When I do, it will say that Test1 is an unused local variable.
Thanks for any help.
God Bless,
Mark A. Sam
and it is unused until you use it somewhere in your code.
GalenS
"Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message
news:eJ******** ******@TK2MSFTN GP10.phx.gbl... Hello,
I am using Visual Web Developer 2005 Express. I want to declare a varible, using Visual Basic as the language and can't get anywhere. For example
Public Test1 as String
I'll get en error saying to change Public to Dim. When I do, it will say that Test1 is an unused local variable.
Thanks for any help.
God Bless,
Mark A. Sam
Sounds like you are trying to declare a local variable, thus Public is not
an option.
You are also declaring a reference type (String), thus your declaration:
Dim Test1 as String
creates a String object variable that references nothing, hence the second
error.
Try something like this:
Dim xx As New String("THIS IS THE STRING")
Actually I'm just playing around trying to learn this stuff. I am
interested in Public variables, becuase I can see a use for them down the
road. Your example worked, but so should mine have worked. I followed the
example in Help. Do you know the syntax for declaring public variables? Do
I need to assign value to variables when they are declared?
Thanks.
Mark Sounds like you are trying to declare a local variable, thus Public is not an option. You are also declaring a reference type (String), thus your declaration:
Dim Test1 as String
creates a String object variable that references nothing, hence the second error.
Try something like this:
Dim xx As New String("THIS IS THE STRING")
Mark A. Sam <ms**@Plan-It-Earth.Net> wrote: I am using Visual Web Developer 2005 Express. I want to declare a varible, using Visual Basic as the language and can't get anywhere. For example
Public Test1 as String
I'll get en error saying to change Public to Dim. When I do, it will say that Test1 is an unused local variable.
It sounds like you're putting that line of code inside a method, making
it a local variable. "Public" only makes sense for an instance or
shared variable.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
"Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message
news:u2******** ******@TK2MSFTN GP09.phx.gbl... Actually I'm just playing around trying to learn this stuff. I am interested in Public variables, becuase I can see a use for them down the road. Your example worked, but so should mine have worked. I followed the example in Help. Do you know the syntax for declaring public variables? Do I need to assign value to variables when they are declared?
Thanks.
Mark
To declare a public variable, do it within your class body, but outside any
code block.
Thanks. That works now. I thought I did that before without success.
Partial Class test
Inherits System.Web.UI.P age
Public variantTest As VariantType
Will this value be available from page to page?
"pvdg42" <pv****@newsgro ups.nospam> wrote in message
news:uV******** ******@TK2MSFTN GP11.phx.gbl... "Mark A. Sam" <ms**@Plan-It-Earth.Net> wrote in message news:u2******** ******@TK2MSFTN GP09.phx.gbl... Actually I'm just playing around trying to learn this stuff. I am interested in Public variables, becuase I can see a use for them down the road. Your example worked, but so should mine have worked. I followed the example in Help. Do you know the syntax for declaring public variables? Do I need to assign value to variables when they are declared?
Thanks.
Mark To declare a public variable, do it within your class body, but outside any code block.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stefanie |
last post by:
Hi,
I have a question about declaring variables for writing data to a file for
random access.
I have two string variables declared in a module (user-defined types).
The point is that for one of them i can't define (hard coded) a fixed
length because the application is reading data
from another file (In that file they have the same lenght).
Is it possible to use the lenght i obtain from reading that other file to
declare my variable or...
|
by: Oliver Corona |
last post by:
I am wondering if anyone has any insights on the performance benefit (or
detriment) of declaring local variables instead of referencing members.
Is allocating memory for a new variable more efficient than repeatedly
referencing the member in a loop?
Maybe using a string isn't the best example, but hopefully you get the
idea!
* example (referencing member):
|
by: Joe |
last post by:
Is it generally considered "better" (i.e. clearer) to declare all variables
at the start of a function or as you need them within it?
Joe
|
by: ross.oneill |
last post by:
Hi,
I am having trouble with a simple task of declaring a variable. Is
this possible?
Here is what I want to do.
DECLARE start_date date;
DECLARE end_date date;
SET start_date = '2005-01-01'
|
by: ColinWard |
last post by:
Hi guys.
I have a question about declaring variables. I do a lot of re-querying
of controls in my database and I use the Set statement with a variable
set to the name of the control to tell the program which control to
requery. This makes it easy to requery controls on a different form.
However, up until today, I was dimming a new local variable for each
control I wanted to deal with ( E.G. Dim cbxctl as control) and then
setting that...
| |
by: jbeteta |
last post by:
Hello,
I have a problem declaring variables. I need to create an object oRpte
as ReportClass on WebForm1.aspx and be able to use its value on
WebForm2.aspx.
For declaring the property oRpte() on WebForm1.aspx, I use "Public
Property" and I declare variable _oRpte as Friend Shared. That's my
problem. If I don't declare _oRpte as Friend Shared, I can't use
WebForm1.oRpte() on other webpage. If I declare _oRpte as Friend
Shared, I can use...
|
by: TARUN |
last post by:
I have a question about declaring the Global.ascx:
In VS.NET I create a Solution, and there are 4 projects under it. They
are put under 4 folders, but web pages would be called across the 4
projects. For example, web page Page1 in Project1 will redirect to web
page Page2 in Project2 which will further redirect to Page3 in
project3 and Page4 in Project4 and finally back to Page1.
In each web page, some session variables, such as...
|
by: SM |
last post by:
I've always wonder if there is diference when declaring and
initializing a varible inside/outside a loop.
What's a better practice?
Declaring and initializing variables inside a loop routine, like this:
for(var i=0; i<list; i++)
{
var name = list;
}
|
by: =?Utf-8?B?QUw=?= |
last post by:
Hi
I usually stick to the convention of not declaring variables in my bodies of
"loops" (including foreach)
ie
int x;
for (int i = 0; i < 10; i++) {
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |