vba 6 to vb.net 2005

patster

New member
Joined
May 10, 2005
Messages
3
Programming Experience
Beginner
Thanks in advance...

How would I write this code in vb2005,

Private Sub txtForemane_Keypress (KeyAscii As Integer)
If KeyAscii >= Asc("0") And KeyAscii <= Asc ("9") Then KeyAscii = 0

I understand that KeyAscii is dissolved with vb2005

Beginner Programmer,

Patster

Also what is the difference between Java, Jscript, J#, J2EE etc...

Thanks again
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
This works for VS2002, VS2003 and VS2005:
VB.NET:
Private Sub txtForemane_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtForemane.KeyPress
  If IsNumeric(e.KeyCode) = True Then e.Handled = True
End Sub

J#.Net was included in VS.Net to allow Java programers the ability to use Java on the .Net platform, i dont know what the variations between them are but J# is Java on .Net
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,335
Location
Sydney, Australia
Programming Experience
10+
Java is the original language developed by Sun Microsystems to allow developers to compile their code once and run it on any platform for which a Java virtual machine exists. A Java virtual machine is a layer that sits between the application and the operating system and translates between the two, similar in some respects to the .NET framework.

JavaScript is a scripting language developed by Netscape to add interactivity and additional features to Web pages. JScript is Microsoft's variation of JavaScript. Despite the name, JavaScript has no connection to the Java language.

J# is a language with "Java-like" syntax to developed to allow Java developers to leverage their existing knowledge on the .NET platform. Since their legal issues with Sun over J++, Microsoft's original "improved" Java for Windows, Microsoft can no longer use the Java name or Logo on their products. I've no doubt that they did not want to produce J#, but they could not afford to just ignore the the large number of Java programmers out there and just hope that they would learn C#.

J2EE is the Enterprise Edition of the Java 2 platform. When you download the Java Run-Time Environment from Sun, you get J2SE (Standard Edition). I've never used it, so I can't speak to the details, but J2EE includes optimised performance and additional tools for large enterprises. My impression is that it is the Java equivalent of the .NET framework and SDK, with maybe some of the features of Visual Studio included.
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
patster said:
Thanks in advance...

How would I write this code in vb2005,

Private Sub txtForemane_Keypress (KeyAscii As Integer)
If KeyAscii >= Asc("0") And KeyAscii <= Asc ("9") Then KeyAscii = 0

I understand that KeyAscii is dissolved with vb2005

Beginner Programmer,

Patster

Also what is the difference between Java, Jscript, J#, J2EE etc...

Thanks again


about the difference among Java, JS, J# and J2EE ....


Java


Simpler than C & C++
  • no pointers
  • no preprocessor
  • automatic garbage collection
Familiarity Similar enough to C and C++ that experienced programmers can get going quickly.
Object Oriented Throughout, e.g. no coding outside of class definitions, including main(). An extensive built-in class library.
Compiler/Interpreter Combo Code is compiled to bytecodes which are interpreted by a virtual machine. Compilation code checking and interpretation, which allows for portability.
Robustness Exception handling built-in, strong type checking (i.e. all variables must be given explicit type), local variables must be initialized.
Platform Independence [size=+2](mostly!)
Security
  • No memory pointers
  • Programs runs inside the virtual machine sandbox.
  • Code checked for pathologies by
    • bytecode verifier
    • class loader
    • security manager
Dynamic Binding Even if libraries are recompiled, there is no need to recompile code that calls classes in those libraries since binding, i.e. the linking of variables and methods to where they are located, is done at runtime. (Unlike C++, which uses static binding => fragile classes. If linked code is changed, pointers can point to the wrong places.)
Good Performance Interpretation of bytecodes slowed performance but new compilers provide performance up to 50% to 100% the speed of C++ programs.
Threading Lightweight processes, called threads, can easily be spun off to perform multi-processing. Great for multi-media.
Built-in Networking [size=+2]Java was designed with networking in mind, it comes with many classes to program internet communications. [/size]
[/size]

JScript

JScript is Microsoft 's extended implementation of ECMAScript (ECMA262), an international standard based on Netscape's JavaScript and Microsoft's JScript languages. JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages, and Windows Script Host. It also means that any application supporting Windows Script can use multiple languages - JScript, VBScript, Perl, and others.


JScript (and the other languages) can be used for both simple tasks (such as mouseovers on Web pages) and for more complex tasks (such as updating a database with ASP or running logon scripts for Windows NT ). Windows Script relies on external "object models" to carry out much of its work. For example, Internet Explorer's DOM provides objects such as 'document' and methods such as 'write()' to enable the scripting of Web pages.


J#

A Microsoft-supported language for .NET. J# (pronounced "jay sharp") is Microsoft's implementation of the Java programming language. It specifically designed to allow Java-language developers to easily transition to the .NET Framework and to create .NET applications. Tools are also available that allow existing Java and Microsoft J++ code to be migrated to J#. Because J# compiles to MSIL and not Java bytecodes, J# applications are not compatible with the Java Virtual Machine (JVM) or the Java 2 platform. However, J# applications can be written using Visual Studio .NET and then compiled using third-party Java tools ....

J2EE

The Java 2 Platform, Enterprise Edition (J2EE) is a set of coordinated specifications and practices that together enable solutions for developing, deploying, and managing multi-tier server-centric applications. Building on the Java 2 Platform, Standard Edition (J2SE), the J2EE platform adds the capabilities necessary to provide a complete, stable, secure, and fast Java platform to the enterprise level. It provides value by significantly reducing the cost and complexity of developing and deploying multi-tier solutions, resulting in services that can be rapidly deployed and easily enhanced.


I hope this topic helped you to clarify what are the differences among these .... Kind regards ;)

 

patster

New member
Joined
May 10, 2005
Messages
3
Programming Experience
Beginner
Resolved

Private Sub txtForemane_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtForemane.KeyPress
If IsNumeric(e.KeyCode) = True Then e.Handled = True
End Sub

Well when I inserted this code I got this Error:

Error 1 'KeyCode' is not a member of 'System.Windows.Forms.KeyPressEventArgs'.

In my code I switched e.KeyCode to e.KeyChar and it worked fine...
Im not sure why but it worked...

Thanks to all who replied
 
Last edited:

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
patster said:
Private Sub txtForemane_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtForemane.KeyPress
If IsNumeric(e.KeyCode) = True Then e.Handled = True
End Sub

Well when I inserted this code I got this Error:

Error 1 'KeyCode' is not a member of 'System.Windows.Forms.KeyPressEventArgs'.

In my code I switched e.KeyCode to e.KeyChar and it worked fine...
Im not sure why but it worked...

Thanks to all who replied

sorry about that, e.KeyCode is available in the KeyDown and KeyUp events, in the KeyPress event it is indeed the e.KeyChar
 
Last edited:
Top Bottom