02-12-2005, 12:49 PM | #1 (permalink) |
Insane
|
[VisualBasic] A few questions on commands
I know java pretty well and am now learning Visual Basic and I'm having some problems.
First, what is the Visual Basic equivalent to Java's try-catch error resolving? I can't find this anywhere in my VB book. Does Basic have something similar? Second, Is there a command to see if a file exists? Thanks
__________________
Mechanical Engineers build weapons. Civil Engineers build targets. |
02-12-2005, 03:24 PM | #3 (permalink) |
Insane
|
well, i'm not using the .net version...VB6 doesn't have that but I found it anway.
I do have another question now though. Can someone explain the structure of a class and relate it to a typical java class? I understand java classes pretty good but I'm pretty lost on VB classes (at least with the variables and properties...I don't understand what those are). Also, with methods, how do I "return" a value?
__________________
Mechanical Engineers build weapons. Civil Engineers build targets. |
02-14-2005, 06:30 AM | #4 (permalink) | |
Muffled
Location: Camazotz
|
Quote:
__________________
it's quiet in here |
|
02-14-2005, 06:47 AM | #5 (permalink) |
Guest
|
A VB Class is not a whole lot different to a Java class. It needs to be defined within a class module, and is simply a collection of hidden variables that are accessed via 'Property Let' and 'Property Get' statements - So, say I want to create a class that represents a Cartesian Coordinate called CartCoord, I'd create a class module Called CartCoord and fill it with the following:
Code:
Private privX as Double Private privY as Double Property Let X (aValue as Double) privX = aValue End Property Property Get X () as Double X = privX End Property Property Let Y (aValue as Double) privY = aValue End Property Property Get Y () as Double Y = privY End Property Property Get DistanceFromOrigin() as Double DistanceFromOrigin = Sqr(PrivX^2 + PrivY^2) End Function Code:
Set MyPoint = New CartCoord MyPoint.X = 3 MyPoint.Y = 4 Z = MyPoint.DistanceFromOrigin Last edited by zen_tom; 02-14-2005 at 06:49 AM.. |
Tags |
commands, questions, visualbasic |
|
|