Du bist hier: Snippet-Verzeichnis » Visual Basic (78)
Sprache:

declaring and manipulating var's with separate functions

Sprache: English
Programmiersprache: Visual Basic
Veröffentlicht von: eleet2k2 [nicht registriert]
Letzte Änderung: 15.05.2006
Aufrufe: 913


Beschreibung

You can declare variables in a form, and then call a Function to modify them and then return the new variable and display it in a lable.

Code

1 'This is in the form, and for a form with a command button named cmdTest, and a lable lblVarEqual. 2 3 Option Explicit 4 5 Private Sub cmdTest_Click() 6 Dim sngVal As Single 7 Dim Ans As Integer 8 9 sngVal = 0.1 10 lblVarEqual.Caption = By10(sngVal) 11 12 End Sub 13 14 15 16 'This goes in the standard module 17 18 Option Explicit 19 20 Public Function By10(ByRef sngVal As Single) As Single 21 By10 = sngVal * 10 22 23 End Function 24

Noch kein Kommentar vorhanden

Dieses Snippet kommentieren

Name *  

E-Mail (wird nicht angezeigt) *    

Website  

Kommentar *  

Sicherheitscode Sicherheitscode *    

RSS