User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 363,380 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,870 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 381 | Replies: 6
Reply
Join Date: Nov 2007
Posts: 6
Reputation: pcr is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pcr pcr is offline Offline
Newbie Poster

vb.net code for searching

  #1  
May 12th, 2008
Can anyone please send code for search form which contains clearing controls,validating and contains same criteria when you click search again button.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Jogja
Posts: 2,265
Reputation: Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice 
Rep Power: 9
Solved Threads: 191
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Nearly a Posting Maven

Re: vb.net code for searching

  #2  
May 12th, 2008
show us your effort friend....
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Join Date: May 2008
Posts: 2
Reputation: tratak is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tratak tratak is offline Offline
Newbie Poster

Re: vb.net code for searching

  #3  
May 13th, 2008
  Dim txtb() As TextBox = {txtA, txtB, txtC}
           For Each ctrl As TextBox In txtb
                ctrl.Text = "" 
           Next

or

For Each ctrl As Object In Me.Controls
                If ctrl.GetType.Name = "TextBox" Then
                    ' do something
                End If
          Next
Reply With Quote  
Join Date: Nov 2007
Posts: 6
Reputation: pcr is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pcr pcr is offline Offline
Newbie Poster

Re: vb.net code for searching

  #4  
May 13th, 2008
can you please send sample program with some search criteria,including clearing controls,validating and search criteria remains same when you click revise again in search form
Reply With Quote  
Join Date: Nov 2007
Location: Jogja
Posts: 2,265
Reputation: Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice 
Rep Power: 9
Solved Threads: 191
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Nearly a Posting Maven

Re: vb.net code for searching

  #5  
May 13th, 2008
Originally Posted by pcr View Post
can you please send sample program with some search criteria,including clearing controls,validating and search criteria remains same when you click revise again in search form

Tratak was given u a codes, use it. however you didn't show how far u done with this? where is your effort? have u read a rules??
We only give homework help to those who show effort
Last edited by Jx_Man : May 13th, 2008 at 9:14 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Join Date: Nov 2007
Posts: 6
Reputation: pcr is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
pcr pcr is offline Offline
Newbie Poster

Re: vb.net code for searching

  #6  
May 13th, 2008
sub clear()

me.combobox1.clear()
me.combobox2.clear()
me.textbox1.clear()
end sub

Private Sub nameTextBox1_Validated(sender As Object, e As System.EventArgs) Handles nameTextBox1.Validated
If IsNameValid() Then
' Clear the error, if any, in the error provider.
nameErrorProvider.SetError(Me.nameTextBox1, "")
Else
' Set the error if the name is not valid.
nameErrorProvider.SetError(Me.nameTextBox1, "Name is required.")
End If
End Sub
Reply With Quote  
Join Date: Nov 2007
Location: Jogja
Posts: 2,265
Reputation: Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice Jx_Man is just really nice 
Rep Power: 9
Solved Threads: 191
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Nearly a Posting Maven

Re: vb.net code for searching

  #7  
May 14th, 2008
this following code to clear controls, you can add what control you want to clear :
  1. Public Sub ClearControl(ByVal root As Control)
  2. For Each ctrl As Control In root.Controls
  3. ClearControl(ctrl)
  4. If TypeOf ctrl Is TextBox Then
  5. CType(ctrl, TextBox).Text = String.Empty
  6. ElseIf TypeOf ctrl Is ComboBox Then
  7. CType(ctrl, ComboBox).Text = String.Empty
  8. End If
  9. Next ctrl
  10. End Sub
  11.  
  12. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  13. ClearControl(Me)
  14. End Sub
Last edited by Jx_Man : May 14th, 2008 at 12:22 am.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb VB.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 12:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC