Valhalla Legends Forums Archive | Visual Basic Programming | ActiveX Control Problem

AuthorMessageTime
Yegg
For some reason my ActiveX program won't work in other Visual Basic 6 forms. For example, I have:

[code]Public Function Username(Info As String)
HashStuff.vUser = Info
End Function[/code]

HashStuff is a Module and vUser is in HashStuff (obviously), it is:

[code]Public vUser As String[/code]

Now, when I make my program into filename.ocx, and I add it to another VB6 form. I try doing,

[code]Private Sub Form_Load()
'bConnecter1 is its name
bConnecter1.Username = "Yegg"
End Sub[/code]

When I try to run the program, an error comes up saying,

[code]Argument not optional[/code]

Any reason why this is happening?

Update: I ficed the problem. :/
February 21, 2005, 4:53 PM
Grok
Try using properties instead of a function, in your class, example:

[code]
'
' this is in the class module MyClass
'
Public Property Get UserName() As String
    UserName = HashStuff.vUser
End Property

Public Property Let UserName(ByVal NewUserName As String)
    HashStuff.vUser = NewUserName
End Property
[/code]
February 21, 2005, 7:50 PM
Dyndrilliac
His problem is using it like a variable when it is a function.

bConnecter1.Username("Username")
February 22, 2005, 6:52 PM

Search