Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 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 8th, 2005, 08:59 PM
Registered User
 
Join Date: Feb 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default validation

if i have 2 text boxes and 1 combobox and 1 search button

i want to see either(any textbox or a combobox) have some data before they hit search button

how do i accomplish that?

 
Old February 9th, 2005, 01:02 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Start with the search button disabled.
In the Change event of each textbox chek whether the concatenated LEN() of the .Text of both boxes is > 0. If so, enable the button, if not disable it.
This way, even if there had been some text, if they delete it the button will be re-disabled.
Add to the test an Or of whether something is selected in the combo.
 
Old February 9th, 2005, 04:12 PM
Registered User
 
Join Date: Feb 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i try doing that but still my search button ignores

here is the code:

    Private Sub txtProductID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtProductID.TextChanged
        If txtProductID.Text.Length > 0 Then
               btnSearch.CausesValidation = False
        End If
    End Sub

 
Old February 9th, 2005, 05:14 PM
Registered User
 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try If Len(txtProductId.Text) > 0 then ...whatever

 
Old February 10th, 2005, 12:26 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Why are you manipulating the .CausesValidation property?
I was talking about changing the .Enabled property...
Code:
    Private Sub txtProductID_TextChanged( ByVal sender As System.Object, _
                                          ByVal e As System.EventArgs _
                                        ) Handles txtProductID.TextChanged
        If txtProductID.Text.Length > 0 Then
               btnSearch.Enabled = True
        End If
    End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
Validation using Validation Framework kalyangvd Struts 1 January 2nd, 2008 06:53 AM
validation mikedeepak ASP.NET 2.0 Basics 0 May 28th, 2007 03:20 AM
Validation g_vamsi_krish ASP.NET 1.0 and 1.1 Professional 2 January 11th, 2006 06:46 AM
Validation koneruvijay ADO.NET 1 January 6th, 2004 09:22 AM





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