Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2006, 12:09 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ebycorreia_81
Default Function to Clear Text array!

I got used to make use of for-next when i want to clear array text boxes. Ex:
dim iNum as long
For iNum = 0 to 9
  textadd(inum).text = ""
next iNum

this time i want make use of a single function where i can just pass the parameters such as the text box name and the number or array.
i was trying this way but unfortunately it did not function because of Type Mismatch.
this is how i do it in my codes:

public function cleartext(text1 as textbox, ival as long)
dim iNum as long
for iNum = 0 to ival
  text1(inum).text) = ""
next iNum
end function

Please give me a more better function for this.

Thanks A lot.

 
Old January 16th, 2006, 05:47 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default



Hi ebycorreia_81,

Use this function instead of yours. checkout the way it's called also.

Private Sub ClearText(ctrl As Object, i As Integer)
    For i = 0 To i
        ctrl(i).Text = ""
    Next
End Sub

Private Sub Command1_Click()
    ClearText Text1, 4
End Sub

Please post if you need more info.

cheers,
  nalla







Similar Threads
Thread Thread Starter Forum Replies Last Post
IRR function or array oneroler84 Access 3 September 7th, 2007 10:37 AM
Passing an array to a Sub or Function donrafeal Access VBA 2 May 11th, 2006 09:39 AM
How to clear all text box in a form at once time richie86 ASP.NET 1.0 and 1.1 Basics 1 October 31st, 2005 04:57 AM
clear array darkhalf Javascript 2 October 30th, 2005 06:50 AM
How to return array value from a function nebpro BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 September 29th, 2004 12:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.