473,385 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

using objects in visual basic

75
Hi all,
i need to clear multiple text box using a single button click how can it be done using objects
Nov 9 '06 #1
3 1322
albertw
267 100+
Hi all,
i need to clear multiple text box using a single button click how can it be done using objects
hi

try

private sub object_click()
text1.text=vbnullstring
text2.text=vbnullstring
etc

end sub
Nov 9 '06 #2
willakawill
1,646 1GB
Hi all,
i need to clear multiple text box using a single button click how can it be done using objects
A standard way of doing this is as follows:
Expand|Select|Wrap|Line Numbers
  1. Dim ctrl As Control
  2.  
  3. For Each ctrl In Me.Controls
  4.    If TypeName(ctrl) = "TextBox" Then
  5.       ctrl.Text = ""
  6.    End If
  7. Next ctrl
  8.  
Nov 9 '06 #3
Killer42
8,435 Expert 8TB
A standard way of doing this is as follows: ...
You can make this kind of thing a common routine to be included in your bag of tricks, for use in any program. To make it more generally applicable, you can allow it to target specific controls. One simple way is to place something in their .Tag property for it to recognise.

For example, if you pass your form to this sub, it will only hit those textboxes which have "/CLEARME" somewhere in their tag.
Expand|Select|Wrap|Line Numbers
  1. Public Sub ClearTextBoxes(frm As Form)
  2.   Dim ctrl As Control
  3.   For Each ctrl In frm.Controls
  4.     If TypeName(ctrl) = "TextBox" Then
  5.       If InStr(ctrl.Tag, "/CLEARME") Then
  6.         ctrl.Text = ""
  7.       End If
  8.     End If
  9.   Next ctrl
  10. End Sub
To call it from a button on the form, for instance, you would just say
Expand|Select|Wrap|Line Numbers
  1. ClearTextBoxes Me
Nov 9 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
14
by: Curtis Tammany | last post by:
Hello- Can someone tell me if DSOFile.dll can be accessed within ASP.NET? DSOFile.dll is registered and I have no problem using it in my .ASP scripts. I have tried the following: Dim...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
1
by: Matt Alanzo | last post by:
On another newsgroup an Access knowledgable party posted: >You should be able to connect an Access ADP to an existing SQLExpress >database running in SQLS 2000 compatibility mode. The only thing...
2
by: news | last post by:
hi im new in the .net environnement i have a work to do in school im able to display a datagrid using a database in access and im also able to display a datagrid using a database in foxpro 8.0...
1
by: Al | last post by:
Anyone know why MS says you can't create a COM class with VB.NET to use in other VB.NET projects? (reference the statement at the bottom of the MSDN article ... Walkthrough: Creating COM Objects...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
6
by: Salman | last post by:
I would like to know how I can distribute the application that I create with Visual C++ express edition. I checked the menu options to find a deploy option similar to the one found on the Visual...
1
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hello everyone: I'm trying to teach myself Visual Basic 2005 .NET and the best way I have found is to create a project in Visual Basic 2005 .NET. The project concept is: I want to create a ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.