UDTs (as was vb6)

  • Thread starter Thread starter StrandElectric
  • Start date Start date
....and to add to the first part of the below, I want to display the accessed
file variables in text boxes Text1, Text2, Text3 and also hold them in
variables OldRefNo, OldName, OldAddress for processing (assuming these are
not reserved words!). From your suggested syntax I hope to be gaining an
understanding of how to apply them to my (much more complicated) accounts
files. I am not expecting you to write finished code for me (!), just code
that works with the examples
 
StrandElectric said:
Amongst the usual entry screen controls and general business logic (which
continue to be straightforward), my application makes use of these things:

1 random access file using UDTs
2 printing variables in formatted columns to a series of tabulated
reports
3 and in passing, nicely graduated colour screens (ie gradients).

1 and 2 were simple in interpreted BASIC, fairly straightforward in vb6 and
completely obscure and incomprehensible (to me anyway) in vb.net.

I've tried to help, but you've refused to provide me with any useful
feedback.

You don't seem to have written a simple test application and given our
suggestions a go. Why not?

If you had, we could have helped more.

I last used UDTs in VB3 and the Printer object in VB4 - however, you CAN
still use them in .NET.

As I've said before, you just have to reference
"Microsoft.VisualBasic.PowerPacks.Vs" - which come with VS 2008 & 2010.

I've already explained how to add this reference.

Despite your lack of cooperation, I have written a little CONSOLE
application to demonstrate what you want to do. It works in VS 2008 &
2010. I haven't tried it in the Express version.

Here it is...

Option Explicit On
Option Strict Off

'Add a reference to: Microsoft.VisualBasic.PowerPacks.Vs

Imports Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Imports System.Drawing

Module Module1

Private m_NameOfFile As String = "C:\temp\claimall.dat"

Private m_Col() As Integer
Private m_Printer As Printer

'VB6 Type...
'Public Type DataBlock1 ' company master information (FBU)
' BusName As String * 30
' Address1 As String * 30
' Address2 As String * 30
' Postcode As String * 6
' Tel As String * 20
' Fax As String * 20
' Email As String * 30
' RegForGST As String * 1
' ABN As String * 15
' GSTPeriod As String * 1
' STS As String * 1
' OpeningCapital As Currency ' 8
' GSTRate As Currency ' 8
' CodesAlreadySetFlag As String * 1
' Spare1 As String * 54
'End Type

Structure ClaimAll
<VBFixedString(30)> _
Public BusName As String
<VBFixedString(30)> _
Public Address1 As String
<VBFixedString(30)> _
Public Address2 As String
<VBFixedString(6)> _
Public Postcode As String
<VBFixedString(20)> _
Public Tel As String
<VBFixedString(20)> _
Public Fax As String
<VBFixedString(30)> _
Public Email As String
<VBFixedString(1)> _
Public RegForGST As String
<VBFixedString(15)> _
Public ABN As String
<VBFixedString(1)> _
Public GSTPeriod As String
<VBFixedString(1)> _
Public STS As String
Public OpeningCapital As Double '255
Public GSTRate As Double
'Public OpeningCapital As Long '255
'Public GSTRate As Long
'Public OpeningCapital As Single '247
'Public GSTRate As Single
'Public OpeningCapital As Decimal '271
'Public GSTRate As Decimal
<VBFixedString(1)> _
Public CodesAlreadySetFlag As String
<VBFixedString(54)> _
Public Spare1 As String
End Structure

Sub Main()

CreateDataFile() 'create two records

ReadRecord(1) 'display record in console
ReadRecord(2)

InitialiseCols() 'initialise columns used for printing
PrintDataFile() 'print data file

Console.WriteLine()
Console.Write("Press any key to continue...")
Console.ReadKey()

End Sub

Private Sub CreateDataFile()
' Create the Random Access file

On Error Resume Next
Kill(m_NameOfFile)
On Error GoTo 0

Dim hFile As Integer = FreeFile()

FileOpen(hFile, m_NameOfFile, OpenMode.Random,
OpenAccess.Write, , Len(New ClaimAll))

Dim rec As ClaimAll

rec = New ClaimAll 'seems to be optional!
With rec 'first record
.BusName = "Acme P/L"
.Address1 = "1 Main St"
.Address2 = "Springfield"
.Postcode = "1000"
.Tel = "555-1111"
.Fax = "555-2222"
.Email = "(e-mail address removed)"
.RegForGST = "Y"
.ABN = "123456789012345"
.GSTPeriod = "1"
.STS = "2"
.OpeningCapital = 1000000.5
.GSTRate = 10
.CodesAlreadySetFlag = "Y"
.Spare1 = "Spare one"
End With
FilePut(hFile, rec)

rec = New ClaimAll
With rec 'second record
.BusName = "Ajax P/L"
.Address1 = "1 Elizabeth St"
.Address2 = "Melbourne"
.Postcode = "3000"
.Tel = "5555-3333"
.Fax = "5555-4444"
.Email = "(e-mail address removed)"
.RegForGST = "Y"
.ABN = "234567890123456"
.GSTPeriod = "2"
.STS = "3"
.OpeningCapital = 2000000.75
.GSTRate = 10
.CodesAlreadySetFlag = "N"
.Spare1 = "Spare two"
End With
FilePut(hFile, rec)

FileClose(hFile)

End Sub

Private Sub ReadRecord(ByVal recordNo As Integer)

Dim rec As New ClaimAll
Console.WriteLine("RecLength: " & Len(rec))

Dim hFile As Integer = FreeFile()

FileOpen(hFile, m_NameOfFile, OpenMode.Random, OpenAccess.Read,
, Len(rec))
FileGet(hFile, rec, recordNo) 'requires "Option Strict Off"
FileClose(hFile)

With rec
Console.WriteLine("{0}", .BusName)
Console.WriteLine("{0}", .Address1)
Console.WriteLine("{0}", .Address2)
Console.WriteLine("{0}", .Postcode)
Console.WriteLine("{0}", .Tel)
Console.WriteLine("{0}", .Fax)
Console.WriteLine("{0}", .Email)
Console.WriteLine("{0}", .RegForGST)
Console.WriteLine("{0}", .ABN)
Console.WriteLine("{0}", .GSTPeriod)
Console.WriteLine("{0}", .STS)
Console.WriteLine("{0}", .OpeningCapital)
Console.WriteLine("{0}", .GSTRate)
Console.WriteLine("{0}", .CodesAlreadySetFlag)
Console.WriteLine("{0}", .Spare1)
End With
Console.WriteLine("===============================")

End Sub

Private Sub PrintDataFile()

Console.WriteLine("Printing...")

m_Printer = New Printer

With m_Printer
.PrintAction = Printing.PrintAction.PrintToPrinter 'in
System.Drawing namespace

.ScaleMode = vbTwips
.PaperSize = vbPRPSA4

'.Font = New Font("Arial", 10, FontStyle.Bold Or
FontStyle.Italic)
.Font = New Font("Arial", 10, FontStyle.Regular)

.CurrentY = 2000
End With

Dim rec As ClaimAll
Dim recLength As Integer = Len(New ClaimAll)
Dim records As Integer = FileLen(m_NameOfFile) \ recLength

Console.WriteLine("RecLength: " & recLength)
Console.WriteLine("Records: " & records)

Dim hFile As Integer = FreeFile()

FileOpen(hFile, m_NameOfFile, OpenMode.Random, OpenAccess.Read,
, recLength)

For recordNo As Integer = 1 To records
rec = New ClaimAll

FileGet(hFile, rec, recordNo) 'requires "Option Strict Off"

PrintRecord(rec)
Next

FileClose(hFile)

m_Printer.EndDoc()

Console.WriteLine("Finished Printing")

End Sub

Private Sub PrintRecord(ByVal rec As ClaimAll)

With m_Printer

If .CurrentY > .ScaleHeight - 1500 Then .NewPage()

.CurrentX = m_Col(0)
.Write(rec.BusName)

.CurrentX = m_Col(1)
.Write(rec.BusName)

.CurrentX = m_Col(2)
.Write(rec.Address1)

.CurrentX = m_Col(3)
.Write(rec.Address2)

.Print() 'new line
End With

End Sub

Private Sub InitialiseCols()

ReDim m_Col(0 To 3)

m_Col(0) = 1000
m_Col(1) = 3000
m_Col(2) = 5000
m_Col(3) = 7000

End Sub
End Module


If you had supplied the data file, then I would have been able to test
whether the above is backward compatible with VB6.

As you can see from the code, the main problem is converting from the
VB6 Currency type to a .NET data type. You will have to tell us whether
Double works in place of Currency.

HTH
 
Am 05.01.2011 04:23, schrieb StrandElectric:
Try this for a start: What and where should the syntax be placed (there are
going to be whole host of forms accessing this) that will enable me to read
a legacy Random Access File called Bloggs. Assume it is made up of records
that are first an integer (1 byte long), second a name string that is 20
chars long. Third an address string that is 30 chars long. I want to read
record no. 6. Then I want to write to record 40 with (from the entry screen)
variable aa for the integer, bb for the first string and cc for the next.

About where to put the code: As you have an entry screen, I guess the actions
are: 1. show the Form, 2. on a button click, the file access should be done
as described. Right? I answer part two here. Do you know how to react on a
Button Click event? I think so.

I'm quarrelling with myself which answer to give because "it depends". You can
do it the quick way or take general considerations into account. But I don't want
to confuse you by elaborating on these considerations, therefore it's hard to say.

But I promised to give a short answer, so...: Put the file access into a
Shared method in a Class. For this purpose, you first have to know what a Class
and a Shared method is.

May I try the shortest explanation possible? Ok, first what a class is, step by step(!):
From UDTs you already know how to put associated data together. In VB6, we already
had classes. In addition to Forms and Modules, these were the main components of
every application. Inside a Class, there are also variables like in a Type because
a Class fulfills the same purpose.

But what is the difference to a Type? The difference is that a Class can also contain
procedures (subs/functions). Why that? I explain it with your address UDT: In the past
decades, it turned out that we often have a bunch of different things to do with the same
UDT. For example save it, load it, print it, whatever. In other words, we always had to
write procedures that were _related_ exclusively to that UDT. So, wouldn't it be useful
if it was possible to put the procedures _inside_ the type, make them a part of the
type? Yes. That's what classes are made for: Into a class, you can put the variables
_and_ the procedures. The same applies to VB.Net. Example (explanation below):

Class Address
Dim Name As String
Dim Street As String

Sub Show()
MsgBox("Address: " & Name & ", " & Street)
End Sub
End Class

- You see a class named "Address".
- The class is a new _type_ that you have written. A Structure is another kind of type.
- You see two variables of type String. The technical term for them are "fields".
- You also see a Sub in the class. The technical term for a procedure in a class is "method".
Inside the method, the fields "Name" and "Street" are accessed, put together as a String
and output in a message box.
- The technical generic term for names like class names, method names, field names is "identifier".
I'll use these terms later on. I will mention and explain more technical terms.

That's how it looks like. And what does it mean?
- You can keep better track of your code because associated things are put together.
You can not tear it apart.
- You see that the fields are simply accessed by mentioning their names. That's how it works:
If the compiler doesn't find a local variable of that name, it looks for a field with that
name.

And how can I use this now? How can I put data in it and how to call the method? Well, I'm
afraid, but it's impossible to explain without going into detail. I'll do this also step by
step, I promise. You can always tell me at which step I was unclear. Ok, let's start:

Imagine, you want to have some of these addresses in (computer) memory. First, we have to
have another term for these "things in memory". They are called "objects". Five addresses
in memory are five objects in memory. As a class is a blueprint for the object, we
also say that an object is "an instance of the class". So, if we talk about an "instance",
it is actually equal to "object". It's just that the word "instance" is usually used as
"instance of [a certain class]". Consequently, creating an object is often called
"instantiation". Sorry for this, but without the right terms, explaining gets hard.

Ok, we have five objects in memory. But how do they get there? How can I change
the field values of these objects? I mean, I have these five addressess but how can
I change their Name and Street? To answer the question, the next term comes into play.
You already know what a "pointer" is? A pointer is a memory address.
If you put something into memory, you must remember where it is by storing the
address (= the pointer) in a variable. To keep it simple, in VB.Net this is called
a "reference". Conclusion: We need a variable to store the reference to an object
in memory in order to be able to access the object.

As stated above, the class Address is a type, Structures are types, Integer, Single,
String are tyes. For the reason how classes are handled, classes are "reference types".
This is also a fixed term.


So, let's do it! The following code is located wherever you want. It is not meant
to be put inside the class. So, first declare a variable that can store a reference
to an object of your own type 'Address':

Dim MyFirstAddress As Address

In VB.Net, whenever the variable starts to live, the stored memory address is 0 (zero).
This is a special value to indicate that the variable does not contain a reference
to an object yet. We say the variable is/contains "Nothing". This is a fixed term, too
(and also a VB.Net keyword).

Now we create an object of type 'Address'. This means, memory is reserved for the object.
As much memory as required to contain all the fields of the object is reserved:

MyFirstAddress = New Address

This is an assignment. On the right of the "=" you see the "New" keyword that
creates the object of the given type 'Address'. The result of the operation is
the reference to the object, and it is stored in the variable.

Still with me? Ok, next step: We have in mind that we have a variable referencing
an object somewhere in memory. Using this variable it must now be possible
to change the content of the object, i.e. change Name and Street. This is just a
matter of syntax:

MyFirstAddress.Name = "name of my first object"

You see? You write down the variable name, followed by a dot, followed by the member
name of the object. I haven't explained "member" yet: It is the generic term for fields
and methods in a class. Our class has two fields + one method = three members.

You probably notice that the member access syntax is not different to Structures (UDTs).
But what you can now also write is:

MyFirstAddress.Show()

That's new, isn't it? With your UDTs, you explicitly had to pass the UDT to a procedure
as an argument. Now you just write it differently. This syntax makes clear that the
member (Name, Street or Show) is "part of the class or object".


We have 6:30 AM, so I'm away now. Following parts in following days. Take your time to read
it, don't become desperate, and please ask if something is unclear. We will get to the
point where it starts making sense.
 
Tom,

C# is a program language taught on universities.

By who were the actual studies done, by those who sell their university
products. A common way of marketing by universities as old as they are.

It is true, most VB developers have lost their interest in all the humbug
they learned from teachers who were/are always 5 years behind.

But my experience is that VB developers need in general shorter time to
adept newer ways of doing things.

A proof: look at VB Net and C#, C# becomes more and more a program language
based on legacy from C++ while VB is expanding.

In VB is introduced on some places the curly bracelet, VB is a full OOP and
OOD implemented language, VB has lost some not anymore needed "musts" like
the line continuation character and much more.
That is because of experience not because of studies.

C# has a bunch of legacy which is already for a long time not needed
anymore. Some examples, on most places the semicolon, the parenthesis around
conditions and the lack of using words like "from" but replacing those by
nothing saying catenations of special characters like :=. All things still
on brought in the language based on the first C principles from C at the
Berkley university. Unlucky enough those even introduce in C# now New thing
like the old VB and JavaScript Variant keyword (oh yes they have even given
it a new nothing saying name "Dynamic", a marketing name like if it was a
new car with extra chrome)

VB is renewing because of the critique thinking about the program language
by their users.

C# and more of those languages are slept in their holy Vatican's; the
universities.

If you see this thread and simply categorise for instance Armin, Mayayana
and me as VB users, than you disapprove in fact all what you wrote.
We are developers (and are not only, we write here about VB because it is
the program language we like the most), who look critical to all theories
which are only created by discussion of non practical developers at
universities.
For me are teachers, who have that as only profession, often almost an
equivalent of marketing guys.

Just my opinion.

Cor


"Tom Shelton" wrote in message
<snip>

Cor, you misunderstand - I was not commenting on your knowledge at all.
I did make comments about vb users in general - and it is absolutely
true, and born out not only in real life experience, but by actual
studies.

I simply don't agree that the terms Mayayana is stuck on are
"marketing" terms. They all have specific meaning in the industry.
 
Tom,

Despite of all theoretical writings by universities and others are for me
most new names around computing introduced simply by programmers.

I've done that often (in Dutch) where words became not only a definition in
the computing but also in the actual business, as programmer you need "one"
word to categorise something for which the business has more, even if it
does not exist so you make it.

At a certain moment those words become general in the business, not only for
computing, because those who write manuals simply take over the words from
the developer who gives them the program to describe. When than from outside
persons also needed one word to categorise something where they were using
more different words for, they took over that word (which you call
definition).

I assume that most words which I created, when I had done it with all the
knowledge about it before I started the program, would have gotten another
name.

Therefore I fully agree with Mayanana that Marketing guys like it to take
over the poorly defined technical terms, which nobody understand sometimes
even the programmer himself not, to use in their advertisements. I've seen
it to often done by the terms (in Dutch) which I've created.

However, we need those words, so what is in a name. What is an "American",
for me it is in fact a person who is born on the American continent, for
others it is a citizen of the USA. What is an European, for you probably
somebody born in Europe, for Armin and me first a citizen from the EU and
than somebody living in Europe.

Cor

"Tom Shelton" wrote in message

Mayayana wrote :
I'd make a distinction between poorly defined
technical terms (namespace)

I would disagree that it is poorly defined... It maybe implemented
differently by differnt languages - but the concept is the same for all
of them.
and marketing
terms (solution / developer / architecting). I don't
know how long "solution" has been around, but
it's nonetheless a marketing term. Those 3 words
are all designed to glorify the original meaning
in some way.

I wouldn't agree with those terms being marketing terms either. They
have specific meanings in this industry. An architect has a very
specific job in a team/project. You may not like the term, but it's
been around for a long time now.
I'd agree about VBers, though. Learning VB is
starting at the top and going down. As is the
case with .Net. I found it very difficult to understand
the meaning of variable at first. x = x + 1 didn't
seem to make sense. It wasn't until I had some
understanding of the underlying hardware that I
could see why programming works the way it does.

I think the problem with something like "namespace"
is that it doesn't really say anything. It means context,
but that means nothing without knowing the context
of what. Just as COM's CreateObject(server.class) is
hard to understand until one knows the basic layout
of COM, with DLLs, typelibs, and classes/objects.
Shelton is a namespace. Tom is a class. Shelton
"disambiguates" the Tom class. Try telling that to
your kids. :)

Actually, reading Armin's explanation, wouldn't
it be accurate to say that importing a namespace
is equivalent to VB6 referencing a typelib?

Not exactly. You can reference a library, but not import the
namespace. If you don't import the namespace (basically, add it to
your current namespace) then you have to fully qualify any objects you
use from that library... So, for example, if I define the following in
my library:

Namespace FireAnt.Util
Public Class FileSystemUtils
...
End Class
End Namespace

And then compile that into an dll - FireAnt.Util.dll

I can reference FireAnt.Util in another project (add references dialog)
- but, unless I add it to the global imports in the project settings, I
would have to type:

Dim fsu As New FireAnt.Util.FileSystemUtils

every single time I wanted to create the object. Alternatively, I can
simply add:

Option Strict On
Option Explicit On
Option Infer On

Imports FireAnt.Util


At the top of my file, and then I can just use:

Dim fsu As New FileSystemUtils

That's assuming of course that you don't have a reference to another
dll with a class called FileSystemUtils. If that was the case, then
you might have to do something like:

Option Strict On
Option Explicit On
Option Infer On

Imports FA = FireAnt.Util
Imports SO = SomeOther.Util ' also has a FileSystemUtils class

And then you could use both in the same code:

Dim fafsu As New FA.FileSystemUtils
Dim sofsu As New SO.FileSystemUtils

You could fully qualify both - but, I like to use namespace alias's,
much less typing that way :)
It's hard to grasp referencing in VB6 until one understands
that these are COM libraries and that, for instance,
to reference Shell Objects is to load the Shell32.dll
COM objects.

Even in com your essentially dealing with namespaces. The naming
convention for com servers - Excel.Applicaton - helps distinguish
Word.Application.
Likewise, a DotNetter encounters the
ability to import without necessarily getting an
explanation of the underlying libraries.

Huh? it's called documentation - which can be generated with various
tools form code comments. Not sure what you mean here.
And it doesn't
help that terms get changed around willy nilly.
(One of the best examples I know of is INI/Registry,
where section/key/value became key/value/data for
no reason.)

Other the the structure of an INI and the Registry are completely
different?
To some extent namespace/class/server/object are
synonymous.

They are essentially the same - because namespaces are a major concept
in C++ which com is based on (yes, you can do com in straight C - but,
it is a pain because really com was based on a basic set of OOP
principals.)
 
Strand,

Fine that you take the car industry as example.

However, in my perception you are describing how the American car industry
was working on demand of their American customers not the general car
industry in the world.

The American car industry kept for centuries everything the same, helped by
the American government; because of so called war reasons there were rules
about cars, some of those rules were seen outside the USA as simply
dangerous.

The only thing the American industry, in my eyes stupid way helped by the
then government like was done in communist countries, was adding every time
more chrome and wings.

However, in Europe we got fine breaks, fine bulbs, fine springs and where
able to go with 130km average an hour (85 miles) on the road without any
problem. In the USA the government changed the maximum speed limit to 60
miles.

The result, a big part of the American people bought simply the Japanese and
European cars to drive, because those where at least much saver. Outside the
USA there was almost not any American car anymore sold.

American industry has learned from that including Microsoft.

So instead of putting new chrome on Visual Basic they took a full revision
on it, introducing all what was needed to go over the new communication
roads, that also needed a wider few on the problem and make it possible to
use a conceptual view. So like currently the American car industry does
also, got VB a bunch of what was already invented and defined for other
languages like C++ and Java.

The USA is still the major player in computer industry, however, be aware a
new country is trying to get its chance, so in my perception if Microsoft
(or any other player in that business) does not what it does like with VB,
we soon will have to learn another natural language if we wanted to be able
to keep going on in future in this business. For both of us that is not such
a problem, but I'm also thinking about other persons in our Atlantic
atmosphere.

Yes like with the step from IBM business machines to mainframe computers we
had to learn, and we had also to learn with the step from Mainframe to
Microcomputers, and we had to learn with the step from Desktop to Internet,
and yes if we want to go on, we have to learn with the step from Internet
Desktop to phone (a step I will not take anymore).

But that is this business, or you try selling old Ford T style cars, where
your gearbox with 2 shifts is changed by an automatic gearbox and has a
bunch of chrome, but still goes over the road like a Ford T.

Just my opinion,

Cor
 
Duh, =>

"Cor" wrote in message
Tom,

C# is a program language taught on universities.

By who were the actual studies done, by those who sell their university
products. A common way of marketing by universities as old as they are.

It is true, most VB developers have lost their interest in all the humbug
they learned from teachers who were/are always 5 years behind.

But my experience is that VB developers need in general shorter time to
adept newer ways of doing things.

A proof: look at VB Net and C#, C# becomes more and more a program language
based on legacy from C++ while VB is expanding.

In VB is introduced on some places the curly bracelet, VB is a full OOP and
OOD implemented language, VB has lost some not anymore needed "musts" like
the line continuation character and much more.
That is because of experience not because of studies.

C# has a bunch of legacy which is already for a long time not needed
anymore. Some examples, on most places the semicolon, the parenthesis around
conditions and the lack of using words like "from" but replacing those by
nothing saying catenations of special characters like :=. All things still
on brought in the language based on the first C principles from C at the
Berkley university. Unlucky enough those even introduce in C# now New thing
like the old VB and JavaScript Variant keyword (oh yes they have even given
it a new nothing saying name "Dynamic", a marketing name like if it was a
new car with extra chrome)

VB is renewing because of the critique thinking about the program language
by their users.

C# and more of those languages are slept in their holy Vatican's; the
universities.

If you see this thread and simply categorise for instance Armin, Mayayana
and me as VB users, than you disapprove in fact all what you wrote.
We are developers (and are not only, we write here about VB because it is
the program language we like the most), who look critical to all theories
which are only created by discussion of non practical developers at
universities.
For me are teachers, who have that as only profession, often almost an
equivalent of marketing guys.

Just my opinion.

Cor


"Tom Shelton" wrote in message
<snip>

Cor, you misunderstand - I was not commenting on your knowledge at all.
I did make comments about vb users in general - and it is absolutely
true, and born out not only in real life experience, but by actual
studies.

I simply don't agree that the terms Mayayana is stuck on are
"marketing" terms. They all have specific meaning in the industry.
 
Thanks again Armin. Plenty to digest here. It will keep me busy for a while.

Strand

Armin Zingler said:
Am 05.01.2011 04:23, schrieb StrandElectric:
Try this for a start: What and where should the syntax be placed (there
are
going to be whole host of forms accessing this) that will enable me to
read
a legacy Random Access File called Bloggs. Assume it is made up of
records
that are first an integer (1 byte long), second a name string that is 20
chars long. Third an address string that is 30 chars long. I want to read
record no. 6. Then I want to write to record 40 with (from the entry
screen)
variable aa for the integer, bb for the first string and cc for the next.

About where to put the code: As you have an entry screen, I guess the
actions
are: 1. show the Form, 2. on a button click, the file access should be
done
as described. Right? I answer part two here. Do you know how to react on a
Button Click event? I think so.

I'm quarrelling with myself which answer to give because "it depends". You
can
do it the quick way or take general considerations into account. But I
don't want
to confuse you by elaborating on these considerations, therefore it's hard
to say.

But I promised to give a short answer, so...: Put the file access into a
Shared method in a Class. For this purpose, you first have to know what a
Class
and a Shared method is.

May I try the shortest explanation possible? Ok, first what a class is,
step by step(!):
From UDTs you already know how to put associated data together. In VB6, we
already
had classes. In addition to Forms and Modules, these were the main
components of
every application. Inside a Class, there are also variables like in a Type
because
a Class fulfills the same purpose.

But what is the difference to a Type? The difference is that a Class can
also contain
procedures (subs/functions). Why that? I explain it with your address UDT:
In the past
decades, it turned out that we often have a bunch of different things to
do with the same
UDT. For example save it, load it, print it, whatever. In other words, we
always had to
write procedures that were _related_ exclusively to that UDT. So, wouldn't
it be useful
if it was possible to put the procedures _inside_ the type, make them a
part of the
type? Yes. That's what classes are made for: Into a class, you can put the
variables
_and_ the procedures. The same applies to VB.Net. Example (explanation
below):

Class Address
Dim Name As String
Dim Street As String

Sub Show()
MsgBox("Address: " & Name & ", " & Street)
End Sub
End Class

- You see a class named "Address".
- The class is a new _type_ that you have written. A Structure is another
kind of type.
- You see two variables of type String. The technical term for them are
"fields".
- You also see a Sub in the class. The technical term for a procedure in a
class is "method".
Inside the method, the fields "Name" and "Street" are accessed, put
together as a String
and output in a message box.
- The technical generic term for names like class names, method names,
field names is "identifier".
I'll use these terms later on. I will mention and explain more technical
terms.

That's how it looks like. And what does it mean?
- You can keep better track of your code because associated things are put
together.
You can not tear it apart.
- You see that the fields are simply accessed by mentioning their names.
That's how it works:
If the compiler doesn't find a local variable of that name, it looks for
a field with that
name.

And how can I use this now? How can I put data in it and how to call the
method? Well, I'm
afraid, but it's impossible to explain without going into detail. I'll do
this also step by
step, I promise. You can always tell me at which step I was unclear. Ok,
let's start:

Imagine, you want to have some of these addresses in (computer) memory.
First, we have to
have another term for these "things in memory". They are called "objects".
Five addresses
in memory are five objects in memory. As a class is a blueprint for the
object, we
also say that an object is "an instance of the class". So, if we talk
about an "instance",
it is actually equal to "object". It's just that the word "instance" is
usually used as
"instance of [a certain class]". Consequently, creating an object is often
called
"instantiation". Sorry for this, but without the right terms, explaining
gets hard.

Ok, we have five objects in memory. But how do they get there? How can I
change
the field values of these objects? I mean, I have these five addressess
but how can
I change their Name and Street? To answer the question, the next term
comes into play.
You already know what a "pointer" is? A pointer is a memory address.
If you put something into memory, you must remember where it is by storing
the
address (= the pointer) in a variable. To keep it simple, in VB.Net this
is called
a "reference". Conclusion: We need a variable to store the reference to an
object
in memory in order to be able to access the object.

As stated above, the class Address is a type, Structures are types,
Integer, Single,
String are tyes. For the reason how classes are handled, classes are
"reference types".
This is also a fixed term.


So, let's do it! The following code is located wherever you want. It is
not meant
to be put inside the class. So, first declare a variable that can store a
reference
to an object of your own type 'Address':

Dim MyFirstAddress As Address

In VB.Net, whenever the variable starts to live, the stored memory address
is 0 (zero).
This is a special value to indicate that the variable does not contain a
reference
to an object yet. We say the variable is/contains "Nothing". This is a
fixed term, too
(and also a VB.Net keyword).

Now we create an object of type 'Address'. This means, memory is reserved
for the object.
As much memory as required to contain all the fields of the object is
reserved:

MyFirstAddress = New Address

This is an assignment. On the right of the "=" you see the "New" keyword
that
creates the object of the given type 'Address'. The result of the
operation is
the reference to the object, and it is stored in the variable.

Still with me? Ok, next step: We have in mind that we have a variable
referencing
an object somewhere in memory. Using this variable it must now be possible
to change the content of the object, i.e. change Name and Street. This is
just a
matter of syntax:

MyFirstAddress.Name = "name of my first object"

You see? You write down the variable name, followed by a dot, followed by
the member
name of the object. I haven't explained "member" yet: It is the generic
term for fields
and methods in a class. Our class has two fields + one method = three
members.

You probably notice that the member access syntax is not different to
Structures (UDTs).
But what you can now also write is:

MyFirstAddress.Show()

That's new, isn't it? With your UDTs, you explicitly had to pass the UDT
to a procedure
as an argument. Now you just write it differently. This syntax makes clear
that the
member (Name, Street or Show) is "part of the class or object".


We have 6:30 AM, so I'm away now. Following parts in following days. Take
your time to read
it, don't become desperate, and please ask if something is unclear. We
will get to the
point where it starts making sense.
 
Jason

I'm struggling with a fixed mindset due to a strange (and near fatal)
illness 8 years ago involving the brain stem. I'm not deliberately
'refusing' anything! It's just that my mind has great difficulty diverging
from a fixed course, which at the moment is vb6 (I had the same problems
getting *into* vb6).

There is plenty here for me to really study. Thanks for your efforts.
 
Hi,


......continued: (continue reading the first part and read on here whenever you're ready)


Class Address
Dim Name As String
Dim Street As String

Sub Show()
MsgBox("Address: " & Name & ", " & Street)
End Sub
End Class

Dim MyFirstAddress As Address

MyFirstAddress = New Address

MyFirstAddress.Name = "name of my first object"

MyFirstAddress.Show()

That's new, isn't it? With your UDTs, you explicitly had to pass the UDT to a procedure
as an argument. Now you just write it differently. This syntax makes clear that the
member (Name, Street or Show) is "part of the class or object".


Ok, you now have seen the difference between a UDT and a Class: A Class can contain
methods. ATM you may doubt that classes are such an important item because you don't
know the other advantages of them yet, but I will tell you about them later because
this isn't the right time yet.

We've also learned what an object and a reference is, and how to access an object's
members.

Being at it, the first thing for today is another explanation of a term: "OOP". OOP is
"object oriented programming". The basic key to it is what you've already learned:
Create objects and work with them. Whenever you're doing OOP it just means
that you are writing and using classes. (I know, one could complicate this description
but I don't.)

Next step in this explanation is dropping the term "UDT". I kept it intentionally
even though it's a VB6 term. Now I reveal the reason for this: As I said before,
in VB.Net, these UDTs/Types are called "Structures". At first sight, they are the same
as the Types in VB6:

Structure Address
Dim Name As String
Dim Street As String
End Structure

You see? No magic here. But now the confusing part: In VB.Net, you can also put
methods into a Structure. Huh?? Wasn't the reason for creating classes the fact
that UDTs can not contain methods? Yes, that was true vor VB6. It is not true
anymore for VB.Net. You are right: there must be another reason why both, classes
and structures, exist. And it is there. Unfortunatelly, I must state the 2nd
time today: Now is not the right time to explain it. In advance, I only say that
the memory management is different between a Structure and a Class. In most
cases, a Class is the right choice, in others a Structure. Later about the
background and how to decide which one to use.

So, from now on I use the word "Structure" instead of "UDT". I hope it's understandable
that I had to keep the term "UDT" in order to give a comprehensible reason why classes
have been introduced. It was (and still is) just not the right time to write about
the real reason in detail. Just remember that it is because of different memory
management. I consider the topic "UDT" closed.



Don't worry, I don't lose sight of our final target:

"Put the file access into a Shared method in a Class.
For this purpose, you first have to know what a Class
and a Shared method is."

We are already at 66% of our way to the destination because we know what
a Class and a method is. What remains is the word "Shared". Let's go on
with it!

Well, shall I give an abstract definition of "Shared" or do you really want
to understand it? With the latter, I must go into details again. But I think
you are ready for them because you want to understand. Here are the details:

As mentioned, an object resides in memory. The more objects you have, the
more memory is used. If one object uses eight bytes, five objects occupy 40 bytes.
If you declare five variables and assign a new object to each variable by
using the New keyword, each variable contains a different memory address.
In other words, the variables contain different references. As writen before,
the field of an object is a member of the object. The fields in our example are
so-called "instance members". That's why I explained the word "instance" before:
As an instance of a Class is also called an object, and as a field is called
a member of a class, a field in our class is also called an instance member.
Read the sentence again, but it's just word twiddling.


In preperation to the following step, I have to add another field to
our class. It's called "ID", an Integer value. Each address object is
to have a unique ID so that we can identify each object by it's ID:

Class Address
Dim Name As String
Dim Street As String
Dim ID As Integer '<---------- a new instance member

Sub Show()
MsgBox("Address: " & ID & ", " & Name & ", " & Street) '<---- ID also added here
End Sub
End Class

Each instance of the Class (=each object) now occupies 4 additional bytes
of memory for the Integer value. This is the place to store the ID in.
Here comes the first version of how to use it:

Dim Address1 As Address
Dim Address2 As Address

Address1 = New Address
Address1.ID = 1
Address1.Name = "Strand"

Address2 = New Address
Address2.ID = 2
Address2.Name = "Zingler"

Here we have two variables and assign a new object to each of them.
The first object carries the ID 1, the second ID 2.


Ok, the ID is another "instance member". As you understand the above, you may ask:
Isn't there a reason why I accentuate the word "instance" in "instance member" or
"instance field" so much? Aren't _all_ fields instance fields? No, they are not!
In our example they are, but not in general: In addition to instance fields there
are "shared fields". So, now we are at it. What is a shared field?

Answer: A shared field is a variable that exists right from the
start of the application til it ends. The field is not part of an object.
We can say that a shared field is part of the type (=of the Class).
Memory for all shared fields is automatically reserved. We don't have
to worry about it and and we don't have to use the New keyword.
It gets clearer if you look at the memory usage. I give an example for
clarification:

Class Address
Dim Shared LastID As Integer '<----------- note the "Shared" here

Dim Name As String
Dim Street As String
Dim ID As Integer

Sub Show()
MsgBox("Address: " & Name & ", " & Street)
End Sub
End Class

Let's look at the life of our application:

1. Right after start, the memory for the shared field "LastID" is automatically
reserved. It's an Integer, so it's 4 bytes. No object has been created yet.

2. Using the expression "new Address" once, the first instance
of our class is created. Now there is the shared field plus one object
in memory.

3. Another use of "new Address" creates the second object.
Now there is the shared field plus two objects in memory.


As a calculation:

memory for shared fields
+ count of objects * memory required per object
---------------------------------------------
total memory consumption

In other words: The shared fields always exist exactly one time, whereas there
are zero to infinite instances of the Class.


Next step: let's make use of the Shared field in order to make it clear.
Before, we've learned how to access members of an object by using the
(abstract) expression

VariableName.MemberName

Knowing that the variable references an object, you should now ask:
Does it make sense to access a _shared_ member using the same syntax?
No, it doesn't. Why? Because the shared members belong to the type,
not to the object. Consequently, a shared member is not accessed
by writing down the variable name referencing the object but by
writing down the type name. In our example:

MsgBox(Address.LastID) 'Outputs the content of the shared field in a message box

So, the general syntax is

TypeName.FieldName

That's how it works. There is nothing more to say about it. I can
only give a useful example to make it clearer. So, let's create
our first task:

You can imagine that in a real environment we don't have consecutive
lines creating one object after the other, so that it is obvious that
they get the IDs 1, 2, etc like in our example. A real life task is
creating a new Address object with a new ID for example by clicking
on a button. Don't worry, I'm not gonna talk about Button-clicks
here.

If you analyze the task you will notice that we must remember the
ID that we've used for an Address in order to know which ID the
next object will get. This we have to do even if we write code the
old-fashioned way. Now comes the Shared field named "LastID" into
play: Yep, that's where we store the last ID assigned to the Address
object created at last. So, let's make use of it:

Dim TheAddress As Address
Dim NewID As Integer

NewID = Address.LastID + 1 'Retrieve the last ID and calculate the new one
Address.LastID = NewID 'Write back the new ID to be used in future

TheAddress = New Address 'Create new Address object
TheAddress.ID = NewID 'Assign the new ID
TheAddress.Name = "Strand"

See the comments for explanation. Does it make sense? Again, remembering
the last ID is not a new technique, it's just where it is stored: in a
Shared field. Again, the advantage of putting it into the class is that
these things belong together. It's the first step to what is called
"encapsulation", which is also a fixed term. It is the basis to further
techniques that give the whole thing even more sense, but I don't
elaborate on these techniques. For you it's just important to know that
it's a way of grouping associated things together. The last ID is
related to this class and therefore it's a good place to store it there.


Ok, back to our final target again: By now you only know what a "shared field"
is. But what is a "shared method"? This was the initial question. You may
anticipate it already: A shared method is a method that is not related to an
object. In a shared method, no instance of the class (= no object) can be
accessed. Inside a shared method, you can only access the shared fields
of the class. I give you an example:

We were talking about code reusage. Code must be designed as abstract
as possible to be able to reuse it. This is to save time. I think this
always makes sense. You already know how to write reusable code:
Write Subs and Functions to avoid writing the same code multiple times
at different locations. Let's have a look at the latter code above:
It does a nice job in creating a new object with a new ID. This is
description predestinates the job to be put into a Function. The
Function does it's job and returns the new object with the new ID:

Function CreateInstance() As Address

Dim TheAddress As Address
Dim NewID As Integer

NewID = Address.LastID + 1 'Retrieve the last ID and calculate the new one
Address.LastID = NewID 'Write back the new ID to be used in future

TheAddress = New Address 'Create new Address object
TheAddress.ID = NewID 'Assign the new ID
TheAddress.Name = "Strand"

CreateInstance = TheAddress 'The function return value is the reference to the object

End Function

The only new thing here is the line "CreateInstance = TheAddress".
Though, you already know how to return a function value. It's the
same with object references, so it's not really new.

Having this new Function, we can modify our main procedure:

Dim Address1 As Address
Dim Address2 As Address

Address1 = CreateInstance()
Address2 = CreateInstance()

It works like you already know it: The function returns a value.
The value is stored in the variable. Be the function return type
an Integer, a Single or an object reference, it's always the same.

You may have noticed that I have concealed something: Where do
we put the Function? For the explanation it was "just there", but
now we need a home for it. I hear you saying: yeah, yeah, let's
make it a Shared Function! Ok, I do as instructed and explain
all the changes below:

Class Address
Dim Shared LastID As Integer

Dim Name As String
Dim Street As String
Dim ID As Integer

Sub Show()
MsgBox("Address: " & Name & ", " & Street)
End Sub

Shared Function CreateInstance() As Address '<--------- Shared keyword added here

Dim TheAddress As Address
Dim NewID As Integer

NewID = LastID + 1 'Retrieve the last ID and calculate the new one
LastID = NewID 'Write back the new ID to be used in future

TheAddress = New Address 'Create new Address object
TheAddress.ID = NewID 'Assign the new ID
TheAddress.Name = "Strand"

CreateInstance = TheAddress 'The function return value is the reference to the object

End Function

End Class


In addition to adding the Shared keyword, I've changed

NewID = Address.LastID + 1
Address.LastID = NewID
to
NewID = LastID + 1
LastID = NewID

Both versions do exactly the same. The reason why "Address." can be dropped
is that the code is already _inside_ the Class Address. As explained
before, name resolution is always done inside out. This also applies
to shared member names: If there is no local variable with the name,
the fields of the Class are sought. So, let's analyze this line:

NewID = LastID + 1

- The name "NewID" is a local variable. It's used as the destination
of the assignment.
- The name "LastID" is not found as a local variable, but it is
found as a Shared field.

So, the reason for putting the Function into the class is that it makes
sense, another time. You must think a little ahead to see the advantage:
We often have to use the same Class in different projects. If everything
related to the Class is put inside, we just have to take the Class
as a whole because everything required is already in it. The old-fashioned
way you'd have some parts of it outside, so you have to collect things
together first before you have all you need. Comprehensive?

The only thing what's missing for our goal is how this beast of a Class is
used now:

Dim Address1 As Address
Dim Address2 As Address

Address1 = Address.CreateInstance()
Address2 = Address.CreateInstance()

You see that the syntax of accessing a shared method is not different
from accessing a shared field. So we can write down the general syntax
for accessing shared members:

TypeName.MemberName



Done! That's it. You have now the theory to follow the instruction:

"Put the file access into a Shared method in a Class.
For this purpose, you first have to know what a Class
and a Shared method is."


Even if you know some basics now, it's only the beginning. Therefore,
I think it's not yet convincing that these efforts will pay later.
To believe it, you'd have to know a few more things. I'll continue
trying to convince you whenever you are ready. And again, please
ask if something is unclear.
 
I'm inclined to agree with Tom, for the most part.
People who start with VB have started a far distance
from the machine itself. It requires interest and effort
to learn what C++ people are forced to learn from
the start. The convenience of VB gets in the way.

On the other hand, C++ people often have a tendency
to feel superior. And it can drive them crazy that people
using higher level languages can do things so much
faster.
(See Joel Spolsky's famous piece:
http://www.joelonsoftware.com/articles/APIWar.html
)

I like to think of it like cooking. C is cooking from
scratch. VB uses pre-prepared sauces and bottled
herbs. Both methods have advantages. Mixing the two
approaches -- as is doable in VB5/6 -- can be even
better. But there will always be smug cooks who claim that
the way they dry their oregano from the garden *makes
all the difference*.

Tom is, by temperament, a "benevolent tyrant". He's
generous when he's in charge, competitive when he's not.
He'll always fight to the end for his position, not hesitating
to use derision and contempt in the process.

He can't concede that "solution" is a marketing term
because at heart he's a company man. For someone like
Tom, the only person worse than the one who beats him
is the one who steps outside the rules of competition --
who steps outside competition altogether.
(Like the high schooler who has the nerve to date the
head cheerleader without even trying out for the football
team. It just ain't right!)

That doesn't bother me. Some of my best friends are
like that. :) But I do find this whole topic
rather odd here. To extend the cooking analogy, VB5/6 is
designed to be as easy as TV dinners. So is .Net. To
claim that C# is superior is still comparing TV dinners.
I've never understood why the arrogant C++ people still
feel "manly" switching to high-level tools like C# or Java,
just so long as the new language has semi-colons and
a C++ appearance. (I suspect that many C++ people would
sooner be caught using even javascript rather than VB.)

I suspect that Microsoft had to hobble
VB.Net slightly, and make C# more "official", because many
of the C++ people never would have accepted C# if VB.Net
and C# were portrayed on equal footing. It would have been
too much for their geek vanity to endure. C# and VB.Net
might be equally TV dinners, but C# must be more equal. :)
 
Mayayana laid this down on his screen :
I'm inclined to agree with Tom, for the most part.
People who start with VB have started a far distance
from the machine itself. It requires interest and effort
to learn what C++ people are forced to learn from
the start. The convenience of VB gets in the way.

My comments were not meant to be derisive - just factual. I like VB -
or I wouldn't hang out in VB groups. My first programming experiences
were basic - but, when I got serious about it as a profession all my
university courses were C++ (well, not 100% - you had to take elective
language course as well, and in those days your choices were VB, COBOL,
and Fortran. I had to take two, and I never took Fortran :)

On the other hand, C++ people often have a tendency
to feel superior.
Indeed.

And it can drive them crazy that people
using higher level languages can do things so much
faster.
(See Joel Spolsky's famous piece:
http://www.joelonsoftware.com/articles/APIWar.html
)

Indeed again. As much as I love C++, it's just not practicle for many
real world problems.
I like to think of it like cooking. C is cooking from
scratch. VB uses pre-prepared sauces and bottled
herbs. Both methods have advantages. Mixing the two
approaches -- as is doable in VB5/6 -- can be even
better.

All of that applies to .NET as well - in fact more so. Do I have to
yet again show you the superior interop cababilities backed into .NET?
But there will always be smug cooks who claim that
the way they dry their oregano from the garden *makes
all the difference*.

And sometimes it does... But, the question is are you willing to pay
the price :)
Tom is, by temperament, a "benevolent tyrant". He's
generous when he's in charge, competitive when he's not.
He'll always fight to the end for his position, not hesitating
to use derision and contempt in the process.

I think if you go back and look at exchanges where I have been hostile,
it was after provocation.

I will discuss a point that I feel strongly about, and I can be a bit
competitive at times :) But, I generally do not get intentionally
derisive unless that attitude is first used on me.
He can't concede that "solution" is a marketing term
because at heart he's a company man.

I would say it depends on context. What are we doing as programmers,
if not providing solutions for particular needs? Now, if you talking
about "solution" as in the VS world, then I would agree. Though, I
don't think it's anything to get all bent out of shape over.
For someone like
Tom, the only person worse than the one who beats him
is the one who steps outside the rules of competition --
who steps outside competition altogether.
(Like the high schooler who has the nerve to date the
head cheerleader without even trying out for the football
team. It just ain't right!)

Not me at all. Sorry. I am perfectly fine to carry on a reasonable
discussion on just about any topic - and I'm not afraid to admit when
I'm wrong or that I don't know.
That doesn't bother me. Some of my best friends are
like that. :) But I do find this whole topic
rather odd here. To extend the cooking analogy, VB5/6 is
designed to be as easy as TV dinners. So is .Net. To
claim that C# is superior is still comparing TV dinners.
I've never understood why the arrogant C++ people still
feel "manly" switching to high-level tools like C# or Java,
just so long as the new language has semi-colons and
a C++ appearance. (I suspect that many C++ people would
sooner be caught using even javascript rather than VB.)

It's not the language, at least not for me. I personally like C style
syntax better is all. Which is why I have moved away from VB for the
most part now.

As for, C# vs VB.NET - there are differences, though with VB10 and C#4
the gaps have narrowed again. As to which is superior... Well, I
suppose that's a matter of personal taste....

I suspect that Microsoft had to hobble
VB.Net slightly, and make C# more "official", because many
of the C++ people never would have accepted C# if VB.Net
and C# were portrayed on equal footing. It would have been
too much for their geek vanity to endure. C# and VB.Net
might be equally TV dinners, but C# must be more equal. :)

Not sure I agree. In the first release at least, there wasn't a hairs
breadth difference between the two (other then syntax) - but, over the
next several versions there was some divergance, and at C#3 versus VB9,
C# was the clear winner (IMHO) - it's not as clear in VB10 and C#4
because there was work done to bring features more in line again.
Though, the VB.NET editor still sucks rocks in VS...
 
Dear Armin

You have gone to immense trouble here, in effect laboriously writing a
manual for me, and I'm afraid I will sound ungrateful, but I ought to stop
you writing any more at this stage!

For reasons which I will not expect you to understand, I will not be able to
fathom much of your reasoning, simply because it is too abstract for my
mind. You are setting out to give me a most thorough grounding in the basics
of vb.net with all the reasons why everything is as it is. But my mind is
chanelled into just doing one task at a time.

You will also have seen Jason's approach. He has set out and again most
laboriously written the whole actual code, soemthing I didn't really expect.
See my replies to him.

Thanks again for your efforts. It may all make sense one day!
 
Dear Jason

I really didn't expect you to actually write the entire code! I am most
grateful for your attempts to help me.

Here are some specific queries. They do not require lengthy theoretical
answers (which I won't understand anyway).

What is a console operation? Is it just one possible approach or the only
one?

You have given some (well heaps of!) code, starting with Option Explicit On
(which I understand!). After the Imports you write 'Module Module1. In vb6 I
became well used to forms as (if you like) distinct chunks of code that
accepted user input and did a job, and I also became familiar with modules,
which were separate chunks of code where (for example) you could put
frequently required 'standard' routines (at least that's how I used them).
Now here you have put the statement 'Module Module1 within this code '. Is
that *within* the form?

Next you dim Private m_NameOfFile. Is that some reserved keyword or could I
have put any variable name like OriginalNameOfFile? The same with 'hFile'
later on and m_Col(1) and m_Printer? and 'rec' too. Are they just the
variable names you've chosen? Can I substitute others that make more sense
to me (I have always found the underscore to be difficult to type).

Please address those *very simply* for this duffer!
 
Mayayana,

I was forced in past, in the time I was using assembler to know every bit in
the computer and all its hardware, almost every bit I could change using the
hardware.

In those days it was not uncommon for some to do that wearing a white dress
to give them some distinct.

I found it boring, and when you have done it more times, it is is just a
long collection of the same kind of tricks.

But you got me with one, I don't know what the meaning of a TV dinner in
your language is.
I think it is something I never make, because I like to create fine meals
and eat those with candle light.

If possible I use oregano from the coast around Napoli in the aromatic air
of the Mediterranean see.

However, when I eat an Hamburger, i use Heinz ketchup because that gives
than the special taste.

What I want to say with this? adapting Armin's style.
Don't generalise; use thing for what they are made.

This thread is almost a discussion about what is better: a hammer or a
screwdriver.

:-)

Cor

"Mayayana" wrote in message
I'm inclined to agree with Tom, for the most part.
People who start with VB have started a far distance
from the machine itself. It requires interest and effort
to learn what C++ people are forced to learn from
the start. The convenience of VB gets in the way.

On the other hand, C++ people often have a tendency
to feel superior. And it can drive them crazy that people
using higher level languages can do things so much
faster.
(See Joel Spolsky's famous piece:
http://www.joelonsoftware.com/articles/APIWar.html
)

I like to think of it like cooking. C is cooking from
scratch. VB uses pre-prepared sauces and bottled
herbs. Both methods have advantages. Mixing the two
approaches -- as is doable in VB5/6 -- can be even
better. But there will always be smug cooks who claim that
the way they dry their oregano from the garden *makes
all the difference*.

Tom is, by temperament, a "benevolent tyrant". He's
generous when he's in charge, competitive when he's not.
He'll always fight to the end for his position, not hesitating
to use derision and contempt in the process.

He can't concede that "solution" is a marketing term
because at heart he's a company man. For someone like
Tom, the only person worse than the one who beats him
is the one who steps outside the rules of competition --
who steps outside competition altogether.
(Like the high schooler who has the nerve to date the
head cheerleader without even trying out for the football
team. It just ain't right!)

That doesn't bother me. Some of my best friends are
like that. :) But I do find this whole topic
rather odd here. To extend the cooking analogy, VB5/6 is
designed to be as easy as TV dinners. So is .Net. To
claim that C# is superior is still comparing TV dinners.
I've never understood why the arrogant C++ people still
feel "manly" switching to high-level tools like C# or Java,
just so long as the new language has semi-colons and
a C++ appearance. (I suspect that many C++ people would
sooner be caught using even javascript rather than VB.)

I suspect that Microsoft had to hobble
VB.Net slightly, and make C# more "official", because many
of the C++ people never would have accepted C# if VB.Net
and C# were portrayed on equal footing. It would have been
too much for their geek vanity to endure. C# and VB.Net
might be equally TV dinners, but C# must be more equal. :)
 
Oh well. Fresh problem! I had a free copy of db2008 express, on which I was
trying all this with the kind help of Armin and Jason in particular. This
morning, I could not access it without signing up for Windows Live. But the
procedure is horrendous (with many unreadable special characters (forgot
their name) and on resetting the password (having been presented with many
'there is something wrong with the security certificate' messages) I could
copy the URL as instructed but not paste it into the browser address bar!
So that's me up the creek without a paddle until I find out WHY I cant
paste. I'll now get a coffee and see if that helps!
 
Am 05.01.2011 19:05, schrieb StrandElectric:
Dear Armin

You have gone to immense trouble here, in effect laboriously writing a
manual for me, and I'm afraid I will sound ungrateful, but I ought to stop
you writing any more at this stage!

For reasons which I will not expect you to understand, I will not be able to
fathom much of your reasoning, simply because it is too abstract for my
mind. You are setting out to give me a most thorough grounding in the basics
of vb.net with all the reasons why everything is as it is. But my mind is
chanelled into just doing one task at a time.

You will also have seen Jason's approach. He has set out and again most
laboriously written the whole actual code, soemthing I didn't really expect.
See my replies to him.

Thanks again for your efforts. It may all make sense one day!

Uhm, don't feel urged to read it within one day! You can time it as you wish.
See it as a learning ressource. I don't know what the other guys say, but
I think, _if_ you intend to go a step further, you should continue reading
because I really made the efforts to a) describe it step-by-step, b) not
assume prior knowledge, c) not forestall anything, d) leave out dispensable
information. I don't want to pat myself on the back, but I think this is all
valuable information - considering the context of a newsgroup.

Anyway, it's just an offer. If not you will read it, maybe someone else will
(well, I doubt. ;-) )

Hence I can't answer your initial question. But maybe you can answer it on
your own one day. :-)
 
Armin Zingler said:
Am 05.01.2011 19:05, schrieb StrandElectric:

Uhm, don't feel urged to read it within one day! You can time it as you
wish.
See it as a learning ressource. I don't know what the other guys say, but
I think, _if_ you intend to go a step further, you should continue reading
because I really made the efforts to a) describe it step-by-step, b) not
assume prior knowledge, c) not forestall anything, d) leave out
dispensable
information. I don't want to pat myself on the back, but I think this is
all
valuable information - considering the context of a newsgroup.

Anyway, it's just an offer. If not you will read it, maybe someone else
will
(well, I doubt. ;-) )

Hence I can't answer your initial question. But maybe you can answer it on
your own one day. :-)

Thanks again Armin. And as un update to my other post I solved my pasting
into browser address problem. It appears that Alt-E, P does not work but CRL
V does! Then an incredibly involved process with Microsoft and I got my
version of 2008Express registered. So now for some more experiments!
 
Am 05.01.2011 19:36, schrieb Cor:
This thread is almost a discussion about what is better: a hammer or a
screwdriver.

:-)

It's the screwdriver! No doubts! :-D
 
To give also some actual answers

"StrandElectric" wrote in message
##What is a console application?
It is a kind of application template you can choose in Visual Basic Express.
File -> New -> Project then a box with all program template opens, a Console
Application is the third template.
It creates an empty application which runs in a Dos Box like with Basic A.

In VB6 you were using what is in VB Express the first template "Windows
Forms Application".

##You have given some (well heaps of!) code, starting with Option Explicit
On
(which I understand!). After the Imports you write 'Module Module1?
That is standard created if you choose for Console Application

##Next you dim Private m_NameOfFile. Is that some reserved keyword?
It is a notation for variables which Jason uses.
Currently the most I see used is the camel notation which would be in this
case mNameOfFile
However, mainly it is like you already thought. In fact you can use what you
want as long as it are not reserved words (From which the most are the same
like in VB6).

Cor
 
Back
Top