Click here to Skip to main content
Click here to Skip to main content

VB.NET User Control: Validate Empty Textbox with Image and Create and Dynamic Insert Query

, 28 Aug 2006
Rate this:
Please Sign up or sign in to vote.
Validate Empty Textbox with Image and Create and Dynamic Insert Query

Sample Image - TextBox_Personalizado.jpg

Contents



-Introduction
-Background
-Using the Code
-Conclusion
-Licensing and Limitation of Liability

Introduction

This User controls uses the following simple controls:textbox , label, button, image (Picture Box).

The purpose of these controls in my case is find the simple way to made dynamic insert queries, I pretend develop for delete query and update query.

The TextBoxControl user control permits any value but when receive an empty value display an image standard for error and notifies the empty field, also you can made a simple relation with ButtonsControl control this relation permits that the TextBoxControl control will be read it by the ButtonsControl.

Background

When you add the TextBoxControl to the form, you can add any as you need and after put into your form the ButtonsControl and configure both.

IMPORTANT: The ButtonsControl Control doesn't make a connection only create an INSERT string and display in message box if you had enable to True the property ModoTest, if you change to False the control will verify your Database Connection and will insert into the table assigned.

UPGRADE 30-AGO-06: Now you can create insert querys and verify that the regitry that you're triying to insert is not repeat in your data table, also is implemented a delete button, just write the TextBoxControl name in the PrimaryKey property field in your ButtonsControl .


Using the Code

1. Download the DLL file and, after unzipping, place it in an appropriate folder of your choosing.
2. In the Visual Studio Toolbox, right click in the General Controls tab to open a popup menu. (A form must be open for the control tabs to show in the Toolbox.) Click on the Add/Remove Items menu item.
3. In the Customize Toolbox dialog box, click on the Browse button to open the DLL file.
4. Click the OK button.

How configure these controls?

TextBoxControl

Property

Type

Description

LabelName

String

Get/Set the Label Name

TextBoxName

String

Get/Set the Textbox Name

TextBoxValue

String

Get/Set the Textbox Value

LabelValue

String

Get/Set the Label Value

ImageEmptyField

System.Drawing.Image

Get/Set the Validation Image

TextboxBackColor

System.Drawing.Color

Get/Set the Textbox Color

TextBoxReadOnly

Boolean

Get/Set the Textbox ReadOnly

ControlAssociated

String

Get/Set the Name of ButtonsControl Associated

DBField

String

Get/Set the Database Field


ButtonsControl

Property

Type

Description

ConnectionString

String

Get/Set the Connection String (not implemented)

DBTable

String

Get/Set the Database Table

TestMode

Boolean

Get/Set the Control Mode

PrimaryKey

String

Get/Set the Table Primary Key


Conclusion

With TextBoxControl control and ButtonsControl control, I can now create records in my data base quickly. I hope you find it useful and if you want to contribute contact me to make this control more robust and flexible for many tasks.

Licensing and Limitation of Liability

You may use all code offered in this article any way you choose without restriction.

Under no circumstances, and under no legal theory, tort, contract, or otherwise, will Roberto Cervantes (hereafter referred to as "software author") or his licensors, be liable to the user of the Double Text library and all code offered in this article (hereafter referred to collectively as "article code") for any damages, including any lost profits, lost data, or other indirect, special, incidental, or consequential damages, arising out of the use or inability to use the article code, and data or information supplied, even if the software author, his licensors, or authorized dealer have been advised of the possibility of such damages, or for any claim by any other party.


License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Roberto Cervantes Rivero
Software Developer
Mexico Mexico
No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 PinmemberHeaven20203-Nov-10 10:32 
GeneralProperty Names PinmemberFabse_net28-Aug-06 21:09 
AnswerRe: Property Names PinmemberRoberto Cervantes Rivero28-Aug-06 21:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150301.1 | Last Updated 28 Aug 2006
Article Copyright 2006 by Roberto Cervantes Rivero
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid