Use the Select Case construct to choose among any number of alternatives your require, based on the value of a single variable. Make effective use of the Select Case construct. For more information about error-handling routines, read Error Handling in Siebel Visual Basic (VB). Especially in a LAN environment, where you cannot be sure that a record has not been changed or deleted by another user, you should create routines that keep the program from failing when it meets an unexpected condition. If Val(Me.GetFieldValue("Rep %")) >75 ThenīusComp_PreSetFieldValue = ContinueOperation For example, in a business component event handler, you should use Me in place of ActiveBusComp, as shown in the following example.įunction BusComp_PreSetFieldValue(FieldName As String, FieldValue As String) As Integer The special object reference Me is a VB shorthand for "the current object." Use it in place of references to active Siebel business objects. You can also use suffix characters on your variable names, as described in Type Characters. One very common convention is to prefix each variable with a letter denoting its type, as shown here. It does not matter what conventions you follow as long as everyone in the programming group follows the same conventions.
#Visual basic case statements code#
Another way to improve the readability of your code is to follow a set of standardized naming conventions. In Siebel VB, you place Option commands in the (general) (declarations) window. If you can avoid using Variant variables, you reduce the amount of memory required by your code, which may make execution faster. If you do not specify a data type, Siebel VB assumes the type Variant, which requires 16 bytes-twice as much memory as the next smallest data type.
You can declare a variable without giving it a data type.
Declaring your variables makes it easier for others to understand your code, and for you to debug the code. As a general rule, use the Option Explicit statement, because it forces you to declare your variables (using the Dim statement) before you use them. If you have never programmed in Visual Basic before, you may find the following hints helpful.ĭeclare your variables. Siebel VB Language Reference > Siebel VB Language Overview > Visual Basic Programming Hints
#Visual basic case statements pdf#
Bookshelf v8.0: Visual Basic Programming Hints Bookshelf Home | Contents | Index | PDF