CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Error in Module

  1. #1
    Join Date
    Nov 2011
    Posts
    2

    Error in Module

    Hi,

    I created a Fuction in the module in order to clear all textboxes in a form.

    The clear button does work but it still displays an error at the bottom saying :

    Expression is of type ........., which is not a collection type.

    Can anyone help me with this ?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Error in Module

    Not without seeing what you did, what you've tried, the error line in question, etc. If you want help, use CODE TAGS and post your code.
    Code:
    ' Like this!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Nov 2002
    Posts
    278

    Re: Error in Module

    Code:
    Private Sub ClearTextControls()
    Dim ctl As Control
        
        For Each ctl In Form1             ' loop all controls on Form1
            If TypeOf ctl Is TextBox Then ' If the control is a TextBox
                ctl.Text = vbNullString   ' set its value to null
            End If
        Next ctl
        
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured