|
-
Jun 8th, 2005, 03:08 PM
#1
Thread Starter
Hyperactive Member
Pubic Sub Blah( Need Help here ?? ) [Resolved]
Ok here is my code.
[code
Public Sub NxAxMxE4( ????? )
Dim str As String
Dim x As Integer
str = Mid(Word, 1, 1) & Base & Mid(Word, 2, 1) & Base & Mid(Word, 3, 1) & Base & Mid(Word, 4, 1)
If Len(str) <= 32 Then
lstGen.AddItem str
End If
End Sub
[/code]
Ok where Base is, that is going to be a letter or letters. I want to be able to call it using a different letter.
Call NxAxMxE4 (xx)
So then Base will equal xx
Call NxAxMxE4 (vv)
So then Base will equal vv
How i do this ??
Last edited by Ricky1; Jun 8th, 2005 at 03:27 PM.
-
Jun 8th, 2005, 03:14 PM
#2
Fanatic Member
Re: Pubic Sub Blah( Need Help here ?? )
like this:
VB Code:
Public Sub NxAxMxE4([b]ByVal Base As String[/b])
Dim str As String
Dim x As Integer
str = Mid(Word, 1, 1) & Base & Mid(Word, 2, 1) & Base & Mid(Word, 3, 1) & Base & Mid(Word, 4, 1)
If Len(str) <= 32 Then
lstGen.AddItem str
End If
End Sub
-
Jun 8th, 2005, 03:15 PM
#3
Thread Starter
Hyperactive Member
Re: Pubic Sub Blah( Need Help here ?? )
damn i was missing the ByVal bit of.
-
Jun 8th, 2005, 03:16 PM
#4
Fanatic Member
Re: Pubic Sub Blah( Need Help here ?? )
If you miss the ByVal off then it defaults to ByRef which still would have worked.
The reason I chose ByVal is because you are not modifying the contents of Base, only reading it.
-
Jun 8th, 2005, 03:17 PM
#5
Thread Starter
Hyperactive Member
Re: Pubic Sub Blah( Need Help here ?? )
doesn't seem to be working
-
Jun 8th, 2005, 03:19 PM
#6
Fanatic Member
Re: Pubic Sub Blah( Need Help here ?? )
What's not working?
How are you calling the sub and what are you passing to it?
-
Jun 8th, 2005, 03:21 PM
#7
Thread Starter
Hyperactive Member
Re: Pubic Sub Blah( Need Help here ?? )
Code:
Public Sub NxAxMxE4(ByVal Base As String)
Dim str As String
Dim x As Integer
str = Mid(Word, 1, 1) & Base & Mid(Word, 2, 1) & Base & Mid(Word, 3, 1) & Base & Mid(Word, 4, 1)
If Len(str) <= 32 Then
lstGen.AddItem str
End If
End Sub
Calling It With This.
Code:
Public Sub Generate()
For I = 0 To lstBase.ListCount - 1
Word = lstBase.List(I)
Call NxAxMxE4(xx)
Next I
End Sub
So If List(i) was Rick i shud get RxxIxxCxxK
-
Jun 8th, 2005, 03:22 PM
#8
Fanatic Member
Re: Pubic Sub Blah( Need Help here ?? )
you need to put quotes around the xx
ie:
-
Jun 8th, 2005, 03:23 PM
#9
Thread Starter
Hyperactive Member
Re: Pubic Sub Blah( Need Help here ?? )
SWeeeeeeeeeeeeeeeeeeeeeeet
Thanks Bro.
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
|