|
-
May 26th, 2005, 08:57 PM
#1
Thread Starter
Lively Member
How to use functions
Hi,
I am very very new to VB and have not yet learned to use functions and would very much like to learn this..
Lets say for example I have a function like this:
VB Code:
Function HexToString(ByVal sText As String) As String
Dim saHex() As String, i As Long
saHex = Split(sText)
For i = 0 To UBound(saHex)
HexToString = HexToString & ChrW("&H" & saHex(i))
Next
End Function
Which are supposed to convert Hex to String, do I just put this randomly in the middle of my code and it will convert all Hex to Strings or..?
For example if I have a textfield where I ask user to enter Hex and another box which shows the converted string, would I then do like Text1.Text = function something..?
Please tell me a little more about functions, thanks alot to all possible repliers! :]
-
May 26th, 2005, 09:16 PM
#2
Re: How to use functions
You have this function:
Function HexToString(ByVal sText As String) As String
Dim saHex() As String, i As Long
saHex = Split(sText)
For i = 0 To UBound(saHex)
HexToString = HexToString & ChrW("&H" & saHex(i))
Next
End Function
You pass a hex string to it, say Hex.text (which is a textbox)
You return it to text1.text (the answer textbox)
You pass Hex.text ( or "AB0D0") like this:
VB Code:
text1.text = HexToString(Hex.text)
or:
VB Code:
text1.text = HexToString("AB0D0")
-
May 27th, 2005, 01:45 AM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|