Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

public function?!!

mostafakamarmostafakamar Posts: 15Member
i wonder if anybody can helpme! is there any thing called public function in VB 6.0 ? and if there is , how can i use it or how can i declare function to be public and how will i call it later.

i would like to know one more thing, how can i restrict the entery of a text box, only ( 0 or 1 ) no other charecters. will it be related to the ASCII code or just use the IF function?
thank you in advance

Comments

  • jlegjleg Posts: 237Member
    [b][red]This message was edited by jleg at 2005-2-20 14:47:8[/red][/b][hr]
    : i wonder if anybody can helpme! is there any thing called public function in VB 6.0 ? and if there is , how can i use it or how can i declare function to be public and how will i call it later.
    :
    : i would like to know one more thing, how can i restrict the entery of a text box, only ( 0 or 1 ) no other charecters. will it be related to the ASCII code or just use the IF function?
    : thank you in advance
    :
    You declare a public function in much to same way as a public procedure.

    Public MyFunction() As String

    If you need to pass variables to the function is could be declared something like this

    [code]
    Public MyFunction( InString As String) As String
    MyFunction = Ucase(InString)
    End Function
    [/code]

    So if you were to use the simple function above you would;

    Dim OutString as String
    OutString = MyFunction("a")

    The returned value would be "A"

    In answer to your second question. I would normally use the keypress event to make sure that the text box only responded to the keys in question. You may also wish to limit the length accepted by the text box.

    Hope this helps

    John ;-)






Sign In or Register to comment.