• Welcome to Valhalla Legends Archive.
 

ActiveX Control Problem

Started by Yegg, February 21, 2005, 10:53 AM

Previous topic - Next topic

Yegg

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

Public Function Username(Info As String)
HashStuff.vUser = Info
End Function


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

Public vUser As String

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

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


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

Argument not optional

Any reason why this is happening?

Update: I ficed the problem. :/

Grok

Try using properties instead of a function, in your class, example:


'
' 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


Dyndrilliac

His problem is using it like a variable when it is a function.

bConnecter1.Username("Username")
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.