Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Enterprise Development / November 2005



Tip: Looking for answers? Try searching our database.

Access .NET classes from VB 5/6?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Richfie1d - 18 Nov 2005 22:03 GMT
.NET has some interesting classes like Char.IsPunctuation that would be
very useful in non-.Net applications. Is there some simple trick to
accessing these from VB 5/6?

Thanks in advance for help with this.

Steve Richfie1d
Douglas Marquardt - 18 Nov 2005 22:27 GMT
Hi Steve:

You'd probably be better off asking this question in a "dotnet" newsgroup.

iac, I do believe you can create a com wrapper class/dll in .net and
call that from vb.

This may help as well:

http://msdn.microsoft.com/vbrun/

Doug.

> .NET has some interesting classes like Char.IsPunctuation that would be
> very useful in non-.Net applications. Is there some simple trick to
[quoted text clipped - 3 lines]
>
> Steve Richfie1d
Bob Butler - 18 Nov 2005 22:28 GMT
> .NET has some interesting classes like Char.IsPunctuation that would
> be very useful in non-.Net applications. Is there some simple trick to
> accessing these from VB 5/6?

you should probably ask in a dotnet group; I'd guess it'd be a matter of
creating a class that exposes the functionality and using COM InterOp to
make it available as a COM object but this is the wrong place to ask.

OTOH, it seems like it'd be adding a huge amount of overhead just to avoid
writing a little code.
Ken Halter - 18 Nov 2005 23:15 GMT
> .NET has some interesting classes like Char.IsPunctuation that would be
> very useful in non-.Net applications. Is there some simple trick to
[quoted text clipped - 3 lines]
>
> Steve Richfie1d

Like Bob mentioned... something like that would be so easy to write, it
wouldn't be worth the hassle of connecting to .Net and it's 20mb framework
that would need to go along with your app everywhere you installed it. These
days, you can find just about anything the framework has (for desktop use)
in the form of a VB code snip/sample, somewhere on the web.
PlanetSourceCode.com alone has over 4 million lines of VB5/6 code
available... While there's some really good stuff there, you still have to
watch out for the whacko's <g>

VB5/6 "Code: 4,296,584. lines"
http://www.planetsourcecode.com/vb/default.asp?lngWId=1

.Net "Code: 338,242. lines"
http://www.planetsourcecode.com/vb/default.asp?lngWId=10

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..

Steve Richfie1d - 19 Nov 2005 04:13 GMT
Ken,

> Like Bob mentioned... something like that would be so easy to write, it
> wouldn't be worth the hassle of connecting to .Net and it's 20mb framework
> that would need to go along with your app everywhere you installed it.

My challenge of the moment is to ID the incoming language to an AI
application. I have the "guts" working great, but in some obscure
languages it is difficult to recognize what a word is, as is needed to
determine the language. Most languages have some small core of words
that appear in most sentences, e.g. the 24 auxiliary verbs in English,
without which you cannot communicate temporal or negation information.
Once the input words are separated, the common words for each language
can be used to ID the language. However, to get there, you must be able
to recognize punctuation in ANY language supported by Unicode. Hence,
writing IsPunctuation would require at least a couple of days of hard
work to ID the punctuation in EVERY language, which I was hoping to avoid.

OTOH, I wonder about VB 2005 Express, which might give me everything -
for free! My one big question/reservation about this is: Does this
compile to native code (e.g. via JIT compilation), or am I stuck with
IL? In this AI application, I need all of the speed that I can get.
Unfortunately, Microsoft is pretty vague about what you get for free.

> These
> days, you can find just about anything the framework has (for desktop use)
> in the form of a VB code snip/sample, somewhere on the web.
> PlanetSourceCode.com alone has over 4 million lines of VB5/6 code
> available...

I've looked pretty hard and not found anything, apparently because the
world hasn't yet quite caught up with automatic language identification.

> While there's some really good stuff there, you still have to
> watch out for the whacko's <g>

Like me?!   B-)

> VB5/6 "Code: 4,296,584. lines"
> http://www.planetsourcecode.com/vb/default.asp?lngWId=1
>
> .Net "Code: 338,242. lines"
> http://www.planetsourcecode.com/vb/default.asp?lngWId=10

Thanks for your interest and help.

Steve Richfie1d
Dick Grier - 20 Nov 2005 16:06 GMT
Hi,

Express compiles, just like "The BIG BOYS."

Dick

Signature

Richard Grier  (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
www.mabry.com/vbpgser4 to order.

Steve Richfie1d - 22 Nov 2005 17:26 GMT
Dick,

> Express compiles, just like "The BIG BOYS."

Thanks. We took a smaller project (a simulator) and converted it to VB
2005. The MAJOR problem with 2005 is that they removed EVERYTHING that
supported NON-object oriented programming. While OO is great for lots of
things, it is most decidedly UNusable for some applications and is most
decidedly UNusable in some places in MOST complex applications,
ESPECIALLY in simulators and state machine logic.

The "choker statement" in the smaller project was a gigantic On GoSub
statement that apparently must be converted to a gigantic Select Case
statement. This mixes main simulator logic with specific component logic
in a most UN-OO way.

The present program (not the smaller project) contains a gigantic ON
GoTo statement as part of a state machine module within an NNTP client,
as the NNTP protocol is horribly designed without any concept of
layering - e.g. you can be interrupted at any point for authentication,
with all outstanding requests being summarily discarded even where the
authentication is successful. This sort of mess demands a state machine
approach. Again, VB 2005 will force us to mix the state machine
switching with the action logic - UGLY by any standard and hard to
maintain because it spreads what should be a single long statement
across dozens of pages of nearly unrelated logic.

To further illustrate, The state machine is now easy to read in VB5,
with what looks like single-thread logic and an occasional GoTo followed
by a label, where control is returned to the state machine controller to
be returned to the following statement at some time in the long distant
future as the result of one of many potential future events. Either I
must scrap this easy-to-maintain structure, or change the On GoTo to a
much larger Select Case statement where every case consists of just a
GoTo Statement (which I will probably do to preserve readability of the
remainder of the program).

All in all, they obviously had some BAD MANAGEMENT at Microsoft in the
program to develop .NET/2005, which concentrated WAY too much on
preserving the weaknesses of the arcane C/C++/C#. Didn't Microsoft learn
ANYTHING from those countless C bugs in Windows that they keep patching
- that you couldn't create in VB if you tried? Now with fast processors
and large memories, there is NOTHING (that I can see) to recommend
C/C++/C# over more protected environments like VB. Of course, with VB
you can always turn the protections off and have pretty much the same
mess that you now have in C/C++/C#.

Don't get me wrong, I have written more C/C++ than I have written VB.
That is enough to know that C/C++ is NOT suitable for complex
applications or simulators where comprehensive testing may be
impractical or downright impossible. Not unusual, some of my projects
started off with fully coded systems that even their authors couldn't
make work right - a pretty much unknown situation in VB. The idiots that
haven't learned this (yet) are now poisoning VB with their continuing
ignorance.

Anyway, I have my answer - yes, VB 2005 DOES appear to be marginally
usable, though the downsides probably equal the upsides. My applications
are somewhat complex/slow client-side applications that are NOT suitable
for making web sites from, so there is little need for .NET/2005 aside
from a few neat subroutines like IsPunctuation, which is where this
entire discussion started.

Thanks Dick and everyone for your continuing help and guidance.

Steve Richfie1d
Dick Grier - 22 Nov 2005 17:53 GMT
Hi,

Hmm...  I'm not sure why you say this:

While OO is great for lots of
things, it is most decidedly UNusable for some applications and is most
decidedly UNusable in some places in MOST complex applications,
ESPECIALLY in simulators and state machine logic.
<<

I do state machines in .NET often.  I find them no harder than VB6.  I'm not
sure about "emulators" though.  I'd have to have a notion about what you
might be emulating (VT100?).

However, you are right.  GoTo and GoSub must be done by some other approach.
Since I haven't used either of these since I started programming in VB
(1992), I have a hard time missing them.

Dick

Signature

Richard Grier  (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
www.mabry.com/vbpgser4 to order.

Steve Richfie1d - 22 Nov 2005 22:39 GMT
Dick,

> While OO is great for lots of
> things, it is most decidedly UNusable for some applications and is most
> decidedly UNusable in some places in MOST complex applications,
> ESPECIALLY in simulators and state machine logic.

> I do state machines in .NET often.  I find them no harder than VB6.

I suspect that one of us knows something that the other doesn't, but I'm
not sure who is ahead. Hence, I'll start out by saying some things for
you to pick holes in.

State machine programming is usually characterized by a state number of
some sort that maps to a place in the code. You affect the outside world
in some way, change your state to redirect control in your code, and
wait for control to pop back when the outside world responds in some way.

Before .NET, you could just funnel all events that might affect your
state to a gigantic On state GoTo places in your program. Now, the only
way to have a many-way branch is with a gigantic Select Case statement
which I presume you are using.

The BIG unanswered question in my mind is whether they have "done their
homework" to build branch tables where the cases are consecutive, or
whether this compiles into a long pile of IF statements so that a branch
near the end can take a LONG time when there are dozens/hundreds of
states. If they have done this homework, than while it would remain ugly
at least it wouldn't be much slower than the On GoTo approach.

> I'm not
> sure about "emulators" though.  I'd have to have a notion about what you
> might be emulating (VT100?).

A horror that might have escaped your notice are the RFCs the describe
the Internet's operation. Anytime you build something to interface to
the Internet, it must typically conform to DOZENS of these RFCs.
Unfortunately, these were generally NOT written by competent
programmers, so there is some of the worst ILlogical operation you could
imagine. For example, users with slow connections take almost forever to
download large numbers of newsgroup postings, because there is no
overlap between Input and Output. No, there is no logical reason for
this situation, just stupidity in the RFCs.

> However, you are right.  GoTo and GoSub must be done by some other approach.
> Since I haven't used either of these since I started programming in VB
> (1992), I have a hard time missing them.

I sure don't use them very often, maybe on average just one place per
major project. However, when you need them, you REALLY NEED them as the
cost of their absence can be rather high, like the entire project runs a
a fraction of the speed that it should run.

The simple GoSub isn't so valuable, because in most cases you could just
move your local variables to become module variables and call the
procedure rather than GoSub'ing to it. Of course, this approach does NOT
work in recursive code, but I don't do much of that.

However, the ON ... statement is another matter. I often implement
compile now and interpret later logic to resolve complex user demands
into simpler procedures to be performed later. This is hard/impossible
to do efficiently without ON statements.

Thanks for the discussion.

Steve Richfie1d
Dick Grier - 23 Nov 2005 17:36 GMT
Hi,

State machine programming is usually characterized by a state number of
some sort that maps to a place in the code. You affect the outside world
in some way, change your state to redirect control in your code, and
wait for control to pop back when the outside world responds in some way.
<<

Dunno.  I've been doing state-machine programming for almost 25 years
(before that, only in hardware, and then only for 8 years or so).  I have a
section on in this topic my book.

Before .NET, you could just funnel all events that might affect your
state to a gigantic On state GoTo places in your program. Now, the only
way to have a many-way branch is with a gigantic Select Case statement
which I presume you are using.
<<

Of course you "could" do it that way -- using GoTo.  Should you?  Not, IMO.

Yes, of course, I suggest either Select Case or If/Then/Else.   GoTo
programming and debugging (and viewing the structure) is a nightmare.
Again, IMO.

Dick

Signature

Richard Grier  (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2  (391 pages) published July 2004.  See
www.mabry.com/vbpgser4 to order.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.