Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 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 February 12th, 2006, 01:56 AM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kevsboy
Default looping events

Good day members! Is there a way where I can loop events? Say:

Public Sub textBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
  'Do something

End Sub

Public Sub textBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
  'Do something

End Sub

Public Sub textBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
  'Do something

End Sub

..... and so on.

What if I have 50 textbox objects, and I need to act on key press entry, is there a way where I don't have to enter these 50 events?

Example:


Public Sub Me.Controls(textBox(i))_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
  'Do something

End Sub

Is there such thing? Thanks for your help!

 
Old February 12th, 2006, 02:14 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

if u r using VB6, then u can use Control Arrays

 
Old February 12th, 2006, 11:04 PM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kevsboy
Default

Got that right ! Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping ssaranam SQL Server 2005 2 April 17th, 2008 01:40 AM
looping mrjoka Classic ASP Basics 1 September 26th, 2007 12:21 AM
Looping deepsea007 XSLT 1 June 14th, 2007 12:13 PM
Looping through rows amysara Excel VBA 1 April 17th, 2007 12:14 AM
Looping..? dedex C# 2 January 6th, 2005 11:24 PM





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