problem in ch13 VB.net step by step 2002

N

nieuwsgroepen

I'm learning Visual Basis.net 2002 edition.
12 chapters are plain sailing, but...

I run into trouble in chapter 13 (build a mortgage payment calculator).

The following line of code causes an error:

MsgBox("The monthly payment is " & Format(Abs(LoanPayment), "$#.##),
,"Mortgage")

The error message indicates an invalid .dll
I included the necessary reference to the excel library 10

The same exercise in VB 6 sbs (chapter 14) went faultlessly.

What's to be done?
 
G

Guest

nieuwsgroepen said:
I'm learning Visual Basis.net 2002 edition.
12 chapters are plain sailing, but...

I run into trouble in chapter 13 (build a mortgage payment calculator).

The following line of code causes an error:

MsgBox("The monthly payment is " & Format(Abs(LoanPayment), "$#.##),
,"Mortgage")

The error message indicates an invalid .dll
I included the necessary reference to the excel library 10

The same exercise in VB 6 sbs (chapter 14) went faultlessly.

What's to be done?

Try: Messagebox.Show
Not: MsgBox (that's a vb6 function)

Chris
 
A

Armin Zingler

I Don't Like Spam said:
Try: Messagebox.Show
Not: MsgBox (that's a vb6 function)


No, it is not a VB6 function. I always use msgbox and I use VB.Net and I do
not use the compatibility library.


Armin
 
J

Joergen Bech

No, it is not a VB6 function. I always use msgbox and I use VB.Net and I do
not use the compatibility library.


Armin

Eh?

If I write

MsgBox("Test1")
MessageBox.Show("Test2")

it will show up as

Interaction.MsgBox("Test1", MsgBoxStyle.OkOnly, Nothing)
MessageBox.Show("Test2")

in .Net Reflector.

"Interaction.MsgBox" as in "Microsoft.VisualBasic.Interaction".

and if I press F2 and search for MsgBox, there is only one
such function.

So how can you say you are not using the compatibility library?

If not "Microsoft.VisualBasic.*", what do you consider
to be the compatiblity library?

TIA,

Joergen Bech

PS: I try consciously to avoid anything in the Microsoft.VisualBasic.*
hierarchy in order to do everything the .Net way. I know full well
that if I use anything from that hierarchy, I will go through another
layer, potentially affecting performance. I am guilty, though, of
always using MsgBox instead of MessageBox.Show. It is just
faster to write and some habits are hard to break.
 
H

Herfried K. Wagner [MVP]

Joergen Bech @ post1.tele.dk> said:
If I write

MsgBox("Test1")
MessageBox.Show("Test2")

it will show up as

Interaction.MsgBox("Test1", MsgBoxStyle.OkOnly, Nothing)
MessageBox.Show("Test2")

in .Net Reflector.

"Interaction.MsgBox" as in "Microsoft.VisualBasic.Interaction".

and if I press F2 and search for MsgBox, there is only one
such function.

So how can you say you are not using the compatibility library?

If not "Microsoft.VisualBasic.*", what do you consider
to be the compatiblity library?
"Microsoft.VisualBasic.Compatibility.dll".

PS: I try consciously to avoid anything in the Microsoft.VisualBasic.*
hierarchy in order to do everything the .Net way.

Well, I wonder why you are still using VB.NET instead of IL assembler, which
is much closer to .NET than VB.NET and C#.
 
J

Joergen Bech

---snip---
"Microsoft.VisualBasic.Compatibility.dll".

I stand corrected. Never made a reference to that file, so I
never noticed it.
Well, I wonder why you are still using VB.NET instead of IL assembler, which
is much closer to .NET than VB.NET and C#.

hehe ... Nah, that would be going a bit too far. Let me put it another
way: Often I need to translate code between VB.Net and C#.
Coming from many years of VB4/5/6, I sometimes had problems
figuring out the equivalent way of writing something in C#, so I
try to find the constructs that are present in both languages and
ditch the VB6-inspired functions from my vocabulary.
Including those in the default Microsoft.VisualBasic.* hierarchy.

/JB
 
A

Armin Zingler

Joergen Bech @ post1.tele.dk> said:
So how can you say you are not using the compatibility library?

If not "Microsoft.VisualBasic.*", what do you consider to be the
compatiblity library?


As it's been stated in the meantime:
Microsoft.VisualBasic.Compatibility.dll


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top