i'm using adodc.
i want to empty all the text box when form load

i already use to reset all that but it cannot work

private sub form_load

txtname.Text = " "
txtIc.Text = " "
cboroom.Text = "<choose room type>"
cbocheckin.Text = "<choose>"
cbocheckout.Text = "<choose>"
cbomonth.Text = "<choose>"
cboyear.Text = "<choose>"

Calling this function will empty all the textboxes within a form...

Public Sub ControlStatus(frm As Form, stat As Boolean)
    On Error Resume Next
    Dim ctrl As Control
    For Each ctrl In frm
        If TypeOf ctrl Is VB.TextBox Then
            ctrl.text = ""
        End If
End Sub

this is a sample one too.....

Private Sub Form_Load()
txtname.Text = " "
txtIc.Text = " "
with cboroom
    .AddItem "<choose room type>"
   .AddItem "Single Bedded AC"
   .AddItem "Double Bedded AC"
end with

with cbocheckin
   .AddItem <Choose>"
  .AddItem "Check in at morning"
  .AddItem "Check in at night" 
end with

with cbocheckout
      .AddItem <Choose>"
     .AddItem "Check out at morning"
    .AddItem "Check out at night" 
end with

Dim i as Integer

cboMonth.AddItem "<Choose>"
for i=1 to 12
   with cbomonth
      .AddItem MonthName(i)
  end with
next i

with cboyear
   .AddItem "<Choose>"
   for i=1900 to Year(Date)
      .AddItem i
   next i
end with
End Sub


This article has been dead for over six months. Start a new discussion instead.