Visual Basic Names - Visual Basic Variabe Names

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #11) by turbopowerdmaxsteel on Jan 1 2007, 05:25 PM. (Line Breaks Removed)
I know we are getting a bit off topic, but...No matter what you call Microsoft's putting together of the trademark Visual Studio members, you can't deny that they have pioneered many new technologies. Let me state some pertaining to the revolutionary Visual Basic.VB6 is undisputedly the world's most popular language.> The name visual itself is very important, for the first time, peo... read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Free Web Hosting > Computers & Tech > Programming > Programming General > BASIC / Visual Basic (.NET)

Visual Basic Names - Visual Basic Variabe Names

Athono
In Visual Basic, what is the difference between:

ResourceName
ResourceName$
ResourceName&

Reply

tansqrx
ohhh, ohh, ohh, pick me, pick me (jumps up and down with hand raised)

I actually had to look this one up because at first I thought they were all completely valid and done the same thing. After typing the variable name in Visual Studio I quickly had to turn to the help. I started in .NET and as such I am mostly ignorant of VB6 which this crap almost certainly came from. My example is for .NET.

In short,

ResourceName valid variable name although it will not compile because no type is given (string, integer, etc.)

ResourceName$ Dim ResourceName as String

ResourceName& Dim ResourceName as Long

Special characters are short hand for assigning a type to a variable name. I have seen this used in older VB6 code but I would never use such bad techniques myself. Other types include:

% - Integer
@ - Decimal
! – Single
# - Double

The MSDN Document

2.2.1 Type CharactersSee Also
Identifiers
A type character following a non-escaped identifier denotes the type of the identifier. The type character is not considered part of the identifier. If a declaration includes a type character, the type character must agree with the type specified in the declaration itself; otherwise a compile-time error occurs. If the declaration omits the type, the type character is implicitly substituted as the type of the declaration.

No white space may come between an identifier and its type character. There are no type characters for Byte or Short.

Appending a type character to an identifier that conceptually does not have a type (for example, a namespace name) will cause a compile-time error.

The following example shows the use of type characters:
CODE

' The following line will cause an error: standard modules have no type.
Module Module1#
End Module

Module Module2
  ' This function takes a Long parameter and returns a String.
  Function StringFunc$(ByVal LongParam&)
     ' The following line causes an error because the type
' character conflicts with the declared type of
' StringFunc and LongParam.
     StringFunc# = CStr(LongParam@)

     ' The following line is valid.
     StringFunc$ = CStr(LongParam&)
  End Function
End Module
TypeCharacter ::=
  IntegerTypeCharacter |
  LongTypeCharacter |
  DecimalTypeCharacter |
  SingleTypeCharacter |
  DoubleTypeCharacter |
  StringTypeCharacter

IntegerTypeCharacter ::= %

LongTypeCharacter ::= &

DecimalTypeCharacter ::= @

SingleTypeCharacter ::= !

DoubleTypeCharacter ::= #

StringTypeCharacter ::= $


Notice from jipman:

code-tags for code next time

 

 

 


Reply

Khymnon
Well, type-characters used to be very nice short-hands before Visual Basic 5. Some old-timers love it and will debate who says otherwise relentlessly :-).

But I suppose you're when you say it's bad; but it's not bad technique, merely bad coding style. At least, I think so.

Reply

tansqrx
OK I will agree with that, just bad coding style. I have just found out that bad coding style can sink a ship quicker than almost anythign else.

Reply

Khymnon
Totally true, transgrx. :-)

Although proper coding styles were a merely means of convenience and maintenance in earlier versions, new features like inheritance, up- and down-casting, polymorphism and the like make it essential to adopt a consistent *correct* style, effectively deminishing the fine line between style and proper syntax.

Actually, I come from a low-level programming background (e.g. C, C++) so I think by now I instinctively force myself to more strict coding styles even if the alternative can do the job well. :-)

Reply

nopaniers
I agree absolutely. These short cuts are there because of backwards compatability. Don't use them if you can possibly avoid it. Something like 80% of software cost is on maintanance so it's worth your time to be clear about the type of a variable...

Reply

dhanesh
Dont Kick my nuts if i am being too VB illiterate .. I just started learning VB as a course in university ..
Please explain in detail for the above, ResourceName$ Dim ResourceName as String and ResourceName& Dim ResourceName as Long

Normally we were told to define a variable like Dim a As Integer , here a being the variable. Where does this ResourceName$ Dim ResourceName come in ? Just a little Inquisitive smile.gif

Regards
Dhanesh.

Reply

Lee-Programmer
QUOTE(dhanesh @ Feb 25 2006, 03:04 PM) *

Dont Kick my nuts if i am being too VB illiterate .. I just started learning VB as a course in university ..
Please explain in detail for the above, ResourceName$ Dim ResourceName as String and ResourceName& Dim ResourceName as Long

Normally we were told to define a variable like Dim a As Integer , here a being the variable. Where does this ResourceName$ Dim ResourceName come in ? Just a little Inquisitive smile.gif

Regards
Dhanesh.


I'm not really trying to tease you here, but that is VB.NET. It has quite some difference to VB6. Doing this in VB6 will cause an error. That's why, trust your instincts, unless you do not feel the passion of programming (Purrr). Form what I could gather, it only exist in VB.NET.

PS: VB.NET is a language for computer servers, hardly useful in a normal program.

Reply

tansqrx
I have to somewhat disagree with your observations that VB.NET is only a server language. I have written many standalone Windows Forms applications. The current program is 10K+ SLOC and I have had no problems with VB.NET yet (in the sense of being a poor programming language). With the advent of the .NET Framework, VB.NET is just as powerful and has 99.9% of the features as C#. It is true that the majority of uses of VB.NET have been with ASP and database applications but I don’t think this is because it is a “server” language.

I guess the bottom line is this. The choice between VB.NET and C# is only what you are used to program in. If you came from C++ then C# is naturally your choice, if coming from VB then you will feel quite at home with VB.NET.

Reply

Lee-Programmer
You may be right about this, but look at the main features of the two similar but different programming languages.

Visual Basic .NET's major advantage is that it has .asp (active server pages) and SQL and built in xml tools. But, it does not do that well with other aspects of programming such as OpenGL and Direct X. It aslo involves with a lot of web controls, giving the hint that it is meant for servers.

Visual Basic 6 has a better capability over things such as graphic manipulation fares better, creating .ocx and .dll and slightly better in API (but not as good in C/C++). As you can see, these things are all local resource programs. Visual Basic 6's internet connection tools are really, bad. The only way it can comunicate is to use a plugin written in some other language, or with API, which is not that great.

And additionally, .NET has this capability of a Client to Server capability included, which was why I said server language (althogh i meant server-client). I have used .NET before, don't think amade random assumtions.

PS: Even if I use GNU C++, I do not really like Microsoft C#. It is just a lousy effort by Microsoft to monoplise the programming language (note that is why we don't get compilers for such programs (such as C# and VB) from non-Microsoft based companies). C++ and Java are open languages, like html, anybody could make compilers for them if they want.

Reply

Latest Entries

turbopowerdmaxsteel
I know we are getting a bit off topic, but...

No matter what you call Microsoft's putting together of the trademark Visual Studio members, you can't deny that they have pioneered many new technologies. Let me state some pertaining to the revolutionary Visual Basic.

VB6 is undisputedly the world's most popular language.

> The name visual itself is very important, for the first time, people could drag and drop controls onto a design surface and see how a program would look without going through the lengthy edit-compile-test cycles required by other languages.

> Stepping through code while debugging - just ask any VB developer if they could do without it.

> The introduction of Active X Controls took the idea of code reusability to a completely new level.

> VB was also the first popular general-purpose language to offer truly integrated database access.

> The IDE concept that VB revolutionized has now been incorporated by non Microsoft products too (Delphi, Java).

> Intellisense - It speeds up software development by reducing the amount of keyboard input required and allows less reference to external documentation due to embedded function signatures and short descriptions.

True it lacked the pure object oriented power of other languages, but hasn't it caught up with .NET? As we programmers grow lazier day by day tongue.gif, changes such as these are greatly welcome and with the further advent of hi-tech sidekicks, we will do so even more.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. naming for visual basic studio - 8.61 hr back. (1)
  2. "valid variable name" visual basic 2005 - 52.83 hr back. (1)
  3. inputting names in visual basic - 266.21 hr back. (1)
  4. conflicting names in vb6 - 278.03 hr back. (1)
  5. basic sign names - 288.21 hr back. (1)
  6. syntax code of command button in visual basic to sink - 321.65 hr back. (1)
Similar Topics

Keywords : visual, basic, names, visual, basic, variabe, names

  1. Necklace Problem In Visual Basic
    (3)
  2. Delete A Registry Subkey And Key
    Using Visual Basic 2005 Express (8)
    Hi, does anyone know how to delete a registry key/subkey using VB 2005 Express. Also, if any other
    methods using VB, C#, C++, J#, post them as well.....
  3. Visual Basic Projects: Scoreboard
    Making a scoreboard with Visual Basic 6 (0)
    Hi again, I've done another visual basic tutorial in this forum on how to make a simple,
    customized web browser. Now I am going to say how to make a scoreboard. To do so, open a Standard
    EXE project in Visual Basic 6.0 and insert 6 labels and 2 command buttons. Change the captions on
    these to: Label1: SCOREBOARD Label2: LIONS Label3: SWANS Label4: 0 Label5: 0 Label6: Waiting for
    update... Command1: TOUCHDOWN Command2: TOUCHDOWN Once you are done, it shoud look like this.
    Press F5 now to see it in action. It won't do anything, seeing as how there is no path ....
  4. Installed Internet Explorer 7?, Visual Basic Now Broken?
    (3)
    This quick guide shows you how to fix this error. Step 1): Go to your control list by right
    clicking the toolbar underneat the default controls and clicking "Components" or by Pressing "CTRL +
    T". Step 2): In the Components Box that pops up scroll down to "Microsoft Internet Controls",
    click on it once so that it becomes highlighted. Now look at its "Location" it will say either
    "C:\Windows\System32\ieframe.dll" or
    "C:\Windows\System32\ieframe.dll\1". Step 3): Now you need to browse for the
    correct file, so with the "Microsoft Inte....
  5. [help] Visual Studio .net 2005 Questions
    (8)
    Heya folks, i am back again with my annoying questions /wink.gif" style="vertical-align:middle"
    emoid=";)" border="0" alt="wink.gif" /> I have this project to submit by the 7th of may and i am
    really desperate for some help here. I will put my questions in numbers so it would be easy for you
    to solve them without confusion. 1) Earlier in a post i had asked if i could create Vista
    compatible applications in VB .NET 2005. Well i got a good response and i went ahead and installed
    the needful, but i still think something is wrong. Not that i know alot of whats going on aro....
  6. Visual Basic Express Tutorials
    Need resources (5)
    I have just downloaded Microsoft Visual Basic Express 2005 and I need a tutorial to help me learn
    how to create simple programs. I have already watched the 16 hour RSS Reader series from Microsoft
    and I'm currently working on that. I also have developed a Web Browser and a weather tracker
    system, from the help of Microsoft E-Books and other Microsoft resources. If you could find any
    non-Microsoft resource on Visual Basic Express, that would be greatly appreciated.....
  7. Is There A Free IDE For VB.NET Programming?
    Needing info on a free VB.net IDE if avaliable (4)
    I know that VB.net is proprietry to Microsoft /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" /> but is there a free IDE that has all the support that VB.NET has? I
    found one before but it just didnt support many of the things that VB.NET does such as timers which
    was really annoying. Does anyone know of any IDEs like this that support the same functions and
    features as VB.NET but without the rather hefty (Over priced, in my opinion) price tag? If anyone
    does then drop me a PM or a reply! Thanks....
  8. Visual Basic.NET Help Needed.
    (7)
    I have a project to submit this wednesday, and i have to make it a working program. Not a big one ..
    but just sumthing small that includes : Splitter, Progress Bar & Track Bar. I thought of making
    sumthing like the picture below, I would enter the text and hit the button .. the text would come in
    BOTH the labels. Then i move the track bar on the left to increase the font or/and the track bar on
    the right to change the color ( RBG only 3 colors ). The progress bar at the bottom will show the
    progress every time i move either of the track bars to a level. Nothing fanc....
  9. New Features In Visual Studio 2005 Windows Forms
    (1)
    i dunno if all of u are by now well versed with the new exciting features in visual studio 2005
    forms, but for me this article was enlightening. for the benifit of others who wre in the dark like
    me.... New Features in Visual Studio 2005 Windows Forms QUOTE The little voice in my head
    shouted "Don't do it! Don't do it!" as I contemplated using the worn out cliché
    "Good things come to those who wait" to describe the experience of designing Windows applications
    with Visual Studio 2005. However, that cliché accurately communicates the idea that bui....
  10. Visual Basic 6 + Crystal Reports 9
    how to distribute (6)
    I have made a software with Visual Basic 6 and Crystal Reprots 9. Now I have to distribute it on the
    client side but the problem is coming in distributing the Crystal Reports. I have tried Setup
    Factory but it is not working. Then I have used Visual Studio Installer from Microsoft and
    downloaded Crystal Report Merge Modules from Business Objects website. It is working properly but
    now the setup file size is very big because it carries a lot of files with it. Is there any other
    installer software which can automatically select the required files to be distribute with the ....
  11. Visual Basic: Random Strings!
    (10)
    This article will teach you how to get random strings for output to a label caption, or anywhere you
    want it to go. 1. First we need to declare our string names: CODE Private
    RndString(2) This declaration says there will be an array of strings called RndString,
    and there will be 2 strings in that array. 2. Then, we need to create a function that will
    generate a random number. CODE Private Function RandomNumber(rUpper As Integer, Optional
    rLower As Integer) As Integer ' Generate random number between upper and lower bound values
      ....
  12. Visual Basic: Change Your Start Button Text! (XP)
    Windows XP ONLY (16)
    Personally, I love this program I made for myself. What the following code will allow you to do is
    change the text of your start button (Duh). You can make it whatever you want, your name, a hobby,
    or even do some extra programming and get it to randomly cycle through captions every 30 seconds or
    so /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> . Here is all the code
    you'll need: CODE Private Const WM_SETTEXT = &HC Private Const WM_GETTEXT = &HD Private
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" ....
  13. Visual Basic: Unload Your Application Correctly!
    (1)
    What many of us do not know is that using a button on a form with the function "Unload Form1" or
    even clicking the X in the upper right corner is like pulling the plug out of your computer while it
    is still on. It may not exit the program cleanly and efficiently, may leave background processes
    running, or just give you unwanted errors by exiting improperly. All you need to do is unload all
    components, forms, controls, etc. upon unloading. Say you have 2 forms in your project, 1
    component, and 2 controls. If these ojects are placed onto a form, unload them properly&....
  14. Visual Basic: Replace Explained!
    (4)
    This tutorial will go over how to effectively use the Replace function in Visual Basic. 1. So
    you have a string. Whether it be a label caption, an entry in a text box by the user of your
    program, or an item in a combo box. Let's say this is a bad string, something you do not want
    to appear. For instance, a user types "X is gay" in a text box, and you want to change that to
    something else. You can simply have it be deleted, or replaced with another value. 2. To make
    this work when a user types something in a textbox, you will need to use this sub: CODE ....
  15. Visual Basic.NET Through Movies
    (0)
    Hi all, I found a very good site at MS which offers 101 short movie clips to strenghten various
    aspects of VB Programming and the IDE. Drastically cuts down on the learning curve. A very useful
    site for beginners: QUOTE Welcome to VB at the Movies. The 101 short films below will provide
    everybody from the beginner through the advanced developer with an opportunity to amp up their
    Visual Basic skills. Grab your popcorn and soda, sit back and enjoy! Source:
    http://msdn.microsoft.com/vbasic/atthemovies/default.aspx If you missed the link above, here
    it is....
  16. Visual Basic Help
    need help useing visual basic (5)
    i was just wondering, when you are useing the program Visual Basic is there any way to add some
    animation to a form, and if so what is a good(cheep) animation program i could get?....
  17. [visual Basic] How To Confirm A Array Is Null
    (6)
    for example, Dim array() as integer during run time, how to confirm a array is null (do not
    contain any element) Thanks....
  18. Visual Basic - make Standard dlls in VB
    written entierly by me (1)
    if you want to know how to make dlls in visual basic, download my submission to
    planet-source-code.com: http://www.planet-source-code.com/vb/scrip...=54190&lngWId=1 Quoting
    what i said on the submission: QUOTE This code will allow you to make your very own stdcall DLL
    files using Visual Basic. The DLLs that you create can be called from any programming language that
    supports stdcall DLLs. Just create or open a project with the functions that you want to export,
    choose the functions to export and click compile! Create your own DLLs that you can call from
    any ....

    1. Looking for visual, basic, names, visual, basic, variabe, names

Searching Video's for visual, basic, names, visual, basic, variabe, names
advertisement




Visual Basic Names - Visual Basic Variabe Names



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE