how can i write codes that only clears specified text boxes

how do i write codes that can only delete the specified text boxes

you can write a function that clears the text boxes that you specify.

'the function takes a parameter coresponding to the name of the text box
function CLEARTEXTBOXES(txtboxname as string, txtboxname2 as string,txtboxname3 as_ string)  ' to txtboxnamen as string
txtboxname.text=""
txtboxname.set focus
end function

if you acall cleartextboxes it will clear your text boxes appropriately.

Guys, we do not use "" in proper coding, but vbNullString as in -

txtBoxName.Text = vbNullString

to clear all textboxes use -

Public Sub ClearAllText(ByVal frm As Form)
Dim ctl As Control  

For Each ctl In frm
    If TypeOf ctl Is TextBox Then
      ctl.Text = vbNullString
    End If
  Next
End Sub

'In your form unload event or button click event do -

Call ClearAllText Me

To clear only certain textboxes as in your case -

Private Sub ClearOnlySomeTextBoxes()
Dim ctl As Control
'
'Go through each control the form has.
For Each ctl In Me.Controls
'
'If the control type is a Textbox control, then...
  If TypeOf ctl Is TextBox And Not ctl.Name = "MyTextboxName" Then

    ctl.Text = vbNullString
  End If
Next
End Sub

Hope this helps.

This is weird im seeing this post by me yet i never posted it.
Any way u guys git it right. but i never posted This thread.

if key down=106 then
sqty.text= text11.text
text11.text=""
text selected
end if

my question ... this code running time when press the * key , value of text11.text pass to sqty.text that time i want to clear thex text11.text ......but text11.text there is no clear show the * ....... please give valube information or code

f key down=106 then
sqty.text= text11.text
text11.text=""
text selected
end if

my question ... this code running time when press the * key , value of text11.text pass to sqty.text that time i want to clear thex text11.text ......but text11.text there is no clear show the * ....... please give valube information or code

This question has already been answered. Start a new discussion instead.