|
| What is VB.NET anyway? |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.languages.vb.
| Joe Griffith |
I've been trying to develop programs in VB.NET without using the Microsoft.Visualbasic namespace. Somehow I got the idea that this was better or purer or faster or something. Is it? I've had an awful time trying to find the pure dot net equivalent of some vb functions. Is it worth my time?
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Lincoln Bovee' |
Yes. This is good for both learning the .NET Framework and better execution. There is a big jump from VB6 to VB.NET and I would recommend getting a book like Wrox's Professional VB.NET to help with the learning curve. There are a lot of good reasons for the massive language changes but in time you will see that they are all better (in my opinion anyways).
The one I struggled with for a bit was connecting and passing parameters to a SQL server Stored Procedure and working with the resulting dataset. Once I figured that one out, the rest seemed to come quicker...
If you get stuck on something specific, post the question here and I'm sure you'll get your answer...
Good luck...
"Joe Griffith" <Click here to reveal e-mail address> wrote in message news:ueAaQJvYBHA.1004@tkmsftngp02... I've been trying to develop programs in VB.NET without using the Microsoft.Visualbasic namespace. Somehow I got the idea that this was better or purer or faster or something. Is it? I've had an awful time trying to find the pure dot net equivalent of some vb functions. Is it worth my time?
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Joe Griffith |
Is it faster? That is my real question. Is there a real reason to avoid Microsoft.Visualbasic. Is performance really better or is it just some sort of zen thing that is good for your soul?
As for specific problems:
I haven't found a .net equivalent to AppActivate. I haven't found a .net equivalent to the Asc function. I haven't found a .net equivalent to the Right function other than a convoluted mess with SubString. I haven't found a .net equivalent to IsDBNull.
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
|
| |
| |
| Mattias Sjögren |
Joe,
>I haven't found a .net equivalent to AppActivate.
Don't think there is any. If you look at the implementation of the AppActivate function, it uses some API functions to do its work.
>I haven't found a .net equivalent to the Asc function.
Convert.ToInt32( yourstring.Chars(0) )
>I haven't found a .net equivalent to the Right function other than a convoluted mess with SubString.
Substring is what you would use.
>I haven't found a .net equivalent to IsDBNull.
Convert.IsDBNull()
Mattias
=== Mattias Sjögren (VB MVP) mattias @ mvps.org http://www.msjogren.net/dotnet/
|
|
|
| |
|
| |
|
| |
| Walt Ritscher |
You can use the Remove method to simulate the Right and Left VB 6.0 functions. Dim strDemo As String = "12345678" 'simulate right function 'return right 4 chars strDemo = strDemo.Remove(0, strDemo.Length - 4) MsgBox(strDemo) strDemo = "12345678" 'simulate left function 'return left 3 chars strDemo = strDemo.Remove(3, strDemo.Length - 3) MsgBox(strDemo)
Walt Ritscher Intelli-trak
On Thu, 01 Nov 2001 12:00:35 -0800, Joe Griffith <Click here to reveal e-mail address> wrote:
[Original message clipped]
|
|
|
| |
|
| |
|
| |
| Rockford Lhotka |
There is no point in avoiding the Microsoft.Visualbasic namespace - it contains functions that are intrinsic to VB and to most any Basic in history. Why wouldn't you use functions that have been 'part of' various basics for well over 20 years?
There is the argument that the .NET framework does all that - which is true, but then every OS has done that stuff for you throughout history, so one could argue whether we should have _ever_ used such a function library.
Following that train of thought - why do C programmers use their runtime? Why doesn't and hasn't everyone always simply called the OS?
Because that is a patently absurd concept. The language runtimes for all languages provide a level of consistency and simplicity over time on a single platform and across platforms. .NET, like any other programming platform/OS, offers a set of services, but that doesn't negate the value of each individual language's runtime.
Rocky
-- Rockford Lhotka Click here to reveal e-mail address http://www.lhotka.net
"Joe Griffith" <Click here to reveal e-mail address> wrote in message news:Oy3af$wYBHA.1636@tkmsftngp02... > Is it faster? That is my real question. Is there a real reason to avoid Microsoft.Visualbasic. Is performance really better or is it just some sort of zen thing that is good for your soul? [Original message clipped]
|
|
|
| |
|
|
| |
| |
| Joe Griffith |
Avoiding the VB runtime (!?) is not absurd if it produces a faster/smaller program.
is: strDemo = strDemo.Remove(0, strDemo.Length - 4)
faster or smaller than: strDemo = Right(strDemo, 4)?
(For me, I guess it would have to be significantly better because it seems like an awfully awkward workaround.)
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Jonathan Allen |
I think Rockford's post was mostly correct. However, he should have mentioned that when near identical methods were found in both, the Class Library version is better. Only when there is no direct correlation (VB Replace, Val, IsNumber, etc.) does the VB version become acceptable.
-- Jonathan Allen
"Joe Griffith" <Click here to reveal e-mail address> wrote in message news:e4ERBFhZBHA.1428@tkmsftngp04... > Avoiding the VB runtime (!?) is not absurd if it produces a faster/smaller program. [Original message clipped]
|
|
|
| |
|
| |
| |
| Joe Griffith |
I would really like a comprehensive list of how to do everything in Microsoft.Visualbasic without importing it. The logical place for this info is in the help file. If each Microsoft.Visualbasic topic just contained a reference to the more fundamental .NET function I could decide for myself which was the most appropriate. I would PAY for such a list if only as a learning tool.
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
|
| |
| |
| Michael Giagnocavo |
From what I understood from a post from someone from MSFT, if you ILDasm some VB-generated code, many of the functions call the class framework anyways. So, why pay, just go dasm yourself.
What I do is every time I need to use a VB function, I just look for the equivalent. Then, I use the equivalent. Sure, somethings don't exist 100% the same, but I've found the .NET Class libraries better at doing it (even if it is a little bit more code).
Also, the compilers aren't as powerful on VB functions. For instance, a loop like: For i = 0 To UBound(myArray) Is far slower than: For i = 0 To myArray.GetUpperbound(0)
I don't know about the rest of the VB functions, but I'd imagine there is some loss... -mike
"Joe Griffith" <Click here to reveal e-mail address> wrote in message news:#jLia$hZBHA.1868@tkmsftngp04... I would really like a comprehensive list of how to do everything in Microsoft.Visualbasic without importing it. The logical place for this info is in the help file. If each Microsoft.Visualbasic topic just contained a reference to the more fundamental .NET function I could decide for myself which was the most appropriate. I would PAY for such a list if only as a learning tool.
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Jonathan Allen |
[Original message clipped]
In the examples you gave, there is definitely no reason not to use the Class Library version. On the other hand, any general purpose Replace function you create will be no faster than VB Replace.
-- Jonathan Allen
"Michael Giagnocavo" <Click here to reveal e-mail address> wrote in message news:#hunaljZBHA.1016@tkmsftngp07... > From what I understood from a post from someone from MSFT, if you ILDasm [Original message clipped]
|
|
|
| |
|
| |
| |
| Joe Griffith |
I can get used to using: For i = 0 To myArray.GetUpperbound(0) instead of: For i = 0 To UBound(myArray)
I may even come to accept it as better in some way.
I don't ever see my self using: strDemo.Remove(0, strDemo.Length - 4) instead of: Right(strDemo, 4)
Unless there is a real good reason. It seems like a real kludge. Other ways I've thought of to "Simulate" the Right$ function are just as bad.
I bought Bill G's first product (4K BASIC for the Altair 8800) around 1976. It had a Right$ function. Why isn't this part of the CLR?
I would still love a book with all of the standard BASIC functions listed along with their .NET equivalents. It would be really useful for making decisions about how to program. I'm already sick of "Getting Started with VB.NET" books and they haven't even released the program yet.
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
|
| |
|
| |
| Joe Griffith |
I can learn to use: For i = 0 To myArray.GetUpperbound(0)
instead of: For i = 0 To UBound(myArray)
and I may even come to accept it as better.
I don't see myself ever using: strDemo.Remove(0, strDemo.Length - 4)
instead of: Right(strDemo, 4)
Unless there is a really good reason to do it. I can already see of other ways to get the Right$ functionality but all of them that I've thought of so far are real kludges. Using ILDASM to see how the compiler does it seems pretty crude as well.
If someone would write a book that listed all of the VB6 functions and how to accomplish the same thing in VB.NET it would be worth a fortune (and would probably be pretty educational too).
I'm already sick of "Getting Started with VB.NET" books (chapter 1: What is VB.NET?).
Of course that is the title of this thread so I guess I shouldn't complain.
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
|
|
|
|
|
|
| |
| Larry Serflaten |
"Rockford Lhotka" <Click here to reveal e-mail address> wrote [Original message clipped]
Because such functions retain the older patterns and thought processes that were in use at the time. For example, the Mid function works using 1 as the lower bound, the position of the first character in the string. .Net now uses 0 for the lower bounds, and as the position for the first character in the string. The two methods are not compatable, and may cause confusion when part of the program assumes one base, and another part assumes a different base, or lower bound.
In other words, learning the new platform may be hindered by having to remember which parts are compatible with the older versions, and which parts are not. To ease that burden, provided that the target is the newer platform, it would be advisable to learn how to program using the patterns and methods supported on the new platform.
[Original message clipped]
That is a bit absurd. The 'subroutine' has been in use a long time. Long enough to develop a set of commonly used routines. Refusing to use them is not a very wise action to take.
[Original message clipped]
You have confused using the .Net approach with using a VB compatibility layer. VB.Net already runs using the .Net runtime, dropping the reference to MS's VisualBasic.Compatibility layer is not like dropping the entire runtime. What you are advising is to retain some level of compatability to the older VB methods.
No doubt they will be a help to some who find continued learning a challenge, but considering that there will be many more 'New' programmers who have yet to learn either .Net, or VB, what point is there in teaching a VB.Net student about what classic VB used to have?
A case in point, when was the last time you had to inform someone how to provide the READ/DATA functionality that 'Basic' used to have? Or, what are you going to tell developers that made heavy use of Gosub, or the Defxxx syntax?
The point is that some of the ideas that used to work, are not being carried forward, even with the compatibility layer. So, while I would not say, 'don't use it', I would expect some developers, (if not most) will want to learn what support there is for today's problems. Some of them were addressed before, and can possibly be found in the compatibility section, but seeing they were problems that needed solving before, should we not expect them to also be addressed in the new platform?
LFS
|
|
|
| |
|
| |
|
|
|
|
| |
| Jonathan Allen |
It is faster, when there are direct equivalents. For instance, the Trim function most likely just calls the String.Trim method, costing you an extra step. Other functions, like Val and Replace, do not have a direct .Net equivalent. In these cases, I would not hesitate to use the VB functions.
-- Jonathan Allen
"Joe Griffith" <Click here to reveal e-mail address> wrote in message news:ueAaQJvYBHA.1004@tkmsftngp02... I've been trying to develop programs in VB.NET without using the Microsoft.Visualbasic namespace. Somehow I got the idea that this was better or purer or faster or something. Is it? I've had an awful time trying to find the pure dot net equivalent of some vb functions. Is it worth my time?
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
|
| |
| |
| Joe Griffith |
Is there any penalty for importing but not useing Microsoft.Visualbasic? Or importing anything and not using it?
What about intallation issues? If you are deploying a winforms program written in VB is there a difference between one that uses Microsoft.Visualbasic and one that doesn't? Is there any difference between declaring the import in code versus adding it to the list of imports in the project properties? Can you assume that if the dotnet framework is installed on a target computer that Microsoft.Visualbasic will be there too?
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Jonathan Allen |
> Is there any penalty for importing but not useing Microsoft.Visualbasic? Or importing anything and not using it?
Import is a design time construct to make typing easier. It should not have an effect on the compiled code.
> What about intallation issues? If you are deploying a winforms program written in VB is there a difference between one that uses Microsoft.Visualbasic and one that doesn't?
Though I am not certain on this, I doubt that you can compile a VB program without referencing the VB runtime.
> Is there any difference between declaring the import in code versus adding it to the list of imports in the project properties?
Import applies to that file only. Other than that, it doesn't really matter.
> Can you assume that if the dotnet framework is installed on a target computer that Microsoft.Visualbasic will be there too?
I don't see why not. It looks like they plan on not making VB.net a second-class citizen like VB6 was.
-- Jonathan Allen
"Joe Griffith" <Click here to reveal e-mail address> wrote in message news:O3VZi7xYBHA.1456@tkmsftngp07... Is there any penalty for importing but not useing Microsoft.Visualbasic? Or importing anything and not using it?
What about intallation issues? If you are deploying a winforms program written in VB is there a difference between one that uses Microsoft.Visualbasic and one that doesn't? Is there any difference between declaring the import in code versus adding it to the list of imports in the project properties? Can you assume that if the dotnet framework is installed on a target computer that Microsoft.Visualbasic will be there too?
Joe Griffith Click here to reveal e-mail address
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
|
|
|
| |
|
| |
| |
| Mattias Sjögren |
Jonathan,
[Original message clipped]
You can, if you compile from the command line and use the (undocumented) /novbruntimeref parameter. That will, of course, cause a bunch of compile errors if your code uses anything in the VB runtime library.
Mattias
=== Mattias Sjögren (VB MVP) mattias @ mvps.org http://www.msjogren.net/dotnet/
|
|
|
| |
|
|
| |
| | |
|
|
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|