VB NET讨论 [英] VB NET Discussion

查看:59
本文介绍了VB NET讨论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


多年来我一直在使用VB 6.0。每次我需要构建软件

应用程序时,我只是打开VB 6.0并开始编码。我现在正在寻找

VB.NET Express Edition,我发现我再也不能这么做了。我发现有太多的代码复制和粘贴,以便获得一个应用程序运行
。我也发现它很慢。是我还是我错过了什么?这是

a我的编码样本,您可以在以下网址找到:

http://www.amtekcenter.com/amtek/wdwscode.htm


PS:我是否需要改变自己的风格编码?我可以在

VB.NET中以相同的方式编码吗?


谢谢!

Hello,

I am using VB 6.0 for many years. Everytime I needed to build software
applications, I just opened VB 6.0 and started coding. I am now looking
VB.NET Express Edition and I find I can no longer do this very easily. I
find that there is too much copy and paste of code in order to get an app
running. I also find it slow. Is it me or I am missing something? Here is
a sample of my coding which you could find at:

http://www.amtekcenter.com/amtek/wdwscode.htm

P.S.: Do I have to change my style of coding? Can I code the same way in
VB.NET?

Thanks!

推荐答案

VB.NET不仅仅是下一个 VB的版本。这是对

编程语言的重大升级,因为语言本身运行在完全不同的运行时(公共语言运行时 - CLR)。该运行时是一个更大的框架(.NET Framework)的一部分。


您多年来使用的大部分语法仍然可能工作,但你会发现

它不再是最佳代码了。例如,您仍然可以在带有MSGBOX的Windows应用程序中生成一个

消息框,但现在有一个公开Show方法的
MessageBox类。它们都可以工作,但是使用$ / b $ b,MessageBox类可以获得更好的效果。有很多这样的例子

就像这样。


这里是另一个......在VB 6.0中,数据类型为整数。意思是16位

整数,现在是整数表示32位整数。如果你没有意识到这一点,那么
意味着你在.NET中使用Integer类型的任何地方,你会使用

的内存是你认为的两倍这个。


IDE也经历了很多变化。


通过查看代码,我可以看到你的大部分代码(虽然合法的

代码)应该被修改,以利用新的语言和对象

VB.NET和.NET Framework的功能。


简而言之,VB.NET不仅仅是你应该试图绊倒你的b / b
的方式。这是一个新的和不同的野兽。它可以如果你正确使用它,你会得到比VB 6.0更好的结果
更好的结果。


你应该看看msdn.microsoft.com和/或拿一个关于.NET的好书。

我建议由Francesco Balena编写Visual Basic .NET

http://www.amazon.com/exec /obidos/AS...85785-0686413)


祝你好运。


" Sharrukin Amiri" < SH ******* @ amtekcenter.com>在留言中写道

news:_p ******************** @ news20.bellglobal.com。 ..
VB.NET is not just the "next" version of VB. It is a major upgrade to the
programming language as the language itself runs on a completely different
runtime (the Common Language Runtime - CLR). That runtime is part of a
larger framework (the .NET Framework).

Much of the syntax you''ve used for years may still "work", but you will find
that it is not optimal code anymore. For example, you can still generate a
message box in a Windows application with MSGBOX, but now there is a
MessageBox class that exposes a Show method. They both will work, but using
the MessageBox class yeilds better results. There are many such examples
like this.

Here''s another one... In VB 6.0, the data type "Integer" meant 16 bit
integer, now "Integer" means 32 bit integer. If you were unaware of this it
would mean that everywhere you used the Integer type in .NET, you''d be using
twice as much memory as you thought you were.

The IDE has also undergone many changes as well.

From looking at your code, I can see that much of your code (while legal
code) should be modified to take advantage of the new language and object
features of VB.NET and the .NET Framework.

In a nutshell, VB.NET is not just something you should try to stumble your
way through. It is a new and different beast. It "can" give you MUCH
better results than VB 6.0, provided you use it correctly.

You should check out msdn.microsoft.com and/or pick up a good book on .NET.
I would recommend Programming Visual Basic .NET by Francesco Balena
(http://www.amazon.com/exec/obidos/AS...85785-0686413).

Good luck.

"Sharrukin Amiri" <sh*******@amtekcenter.com> wrote in message
news:_p********************@news20.bellglobal.com. ..
您好,

我使用VB 6.0多年。每次我需要构建软件应用程序时,我只是打开VB 6.0并开始编码。我现在正在寻找VB.NET Express Edition,我发现我再也不能这么做了。我发现有太多的代码复制和粘贴,以便让应用程序运行。我也发现它很慢。是我还是我错过了什么?这里
是我的编码样本,你可以在这里找到:

http://www.amtekcenter.com/amtek/wdwscode.htm

PS:我是否必须改变我的编码风格?我可以在VB.NET中以相同的方式编码吗?

谢谢!
Hello,

I am using VB 6.0 for many years. Everytime I needed to build software
applications, I just opened VB 6.0 and started coding. I am now looking
VB.NET Express Edition and I find I can no longer do this very easily. I
find that there is too much copy and paste of code in order to get an app
running. I also find it slow. Is it me or I am missing something? Here
is
a sample of my coding which you could find at:

http://www.amtekcenter.com/amtek/wdwscode.htm

P.S.: Do I have to change my style of coding? Can I code the same way in
VB.NET?

Thanks!



Sharrukin,


我只会轻易改变你的编码风格。基本上没有错,

然而你使用的是过去非常多。它现在看起来因为使用了

的方法而不是非常老的Basic。虽然我可以看到你的程序流程,但在我看来更重要的是,不会因为b $ b看起来不对。


我肯定会做的七个建议(不是基于VBNet Express 2005

但是一般的VBNet编程)


1.

不要在开始时将所有值和对象设置为全局,但是在需要的过程/方法中尝试声明它们很多。你的方式

它现在花费更多的内存和更多的工作来跟踪你自己使用的

值/对象。


当一个程序超出范围时,所有没有参考资料的物品/物品将被销毁。这是

OOP的基础知识之一。它需要花费更多的开销,但OOP

的普遍接受效果是因为处理器的速度必须是否定的。


2.

不要使用On Error但是Try Catch。这给你一个更好的程序

流量,并显示你正在做的更好。


3.

不要使用非常经典的东西如Po
Sharrukin,

I would only lightly change your style of coding. Basically it is not wrong,
however what you use is very much from the past. It looks now because of the
used methods as not very much evaluated very old Basic. While as far as I
can see your program flow, what is in my opinion more important, does not
look wrong.

Seven advices that I surely would do (not based on VBNet Express 2005
however on VBNet programming in general)

1.
Don''t set all your values and objects global at the start, however try as
much to declare them in the procedures/methods where needed. The way you do
it now cost more memory and much more work to keep track of the used
values/objects for yourself.

When a procedure goes out of scope all values/objects that has no reference
to it or from it anymore will be destroyed. This is one of the basics of
OOP. It cost more overhead, however is a general accepted effect from OOP
that because of processor speed has to be negate.

2.
Don''t use the On Error however the Try Catch. That gives you a nicer program
flow and shows better what you are doing.

3.
Don''t use the very classic things as Po


。只需看看网站

MSDN.Microsoft.Com就可以了解如何做到这一点。


4.

试试通过实例全球化在Net内置类中使用。有它

看起来无穷无尽,即使你很久很忙,你也有了b / b
这个改变明天就是你从未见过的。这让你的生活更轻松



5

不要使用电话,不再需要了


6.

删除不再需要的所有代码,现在标记为

注释。这是一个非常古老的不再做的习惯,它会让人感到困惑,而且b $ b会让你的程序更难以理解。


7.

大多数在我看来现在使用的是骆驼案例符号,而不是

下划线。然而,这是一个优先选择。


我希望这会有所帮助,


Cor
. Just have a look at the website
MSDN.Microsoft.Com in samples how this is done.

4.
Try to use in Net inbuilt classes as by instance globalization. There are it
seems endless much and even when you are longtimes busy with it, you have
the change to see tomorrow one you never had seen. This makes your live
easier

5
Don''t use the Call, that is not needed anymore

6.
Delete all code that is not needed anymore and you have now marked with as
comment. This is a very old not anymore done habit, it confuses to much and
makes your program not better readable.

7.
Mostly is in my opinion now used camel case notations, and not the
underscore. However that is a mater of preference.

I hope this helps,

Cor


这篇关于VB NET讨论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆