Results 1 to 9 of 9

Thread: [RESOLVED] For each Method

  1. #1

    Thread Starter
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Resolved [RESOLVED] For each Method

    hi guys, i have 3 textbox like this :
    ForEach Code:
    1. Private Sub Command1_Click()
    2. Dim a As Object
    3. Dim T As TextBox
    4. Set a = T
    5. For Each a In Form1
    6.     a.Text = "TEST"
    7. Next a
    8. End Sub

    but after the last text have been filled with "TEST" it show msgbox "Run Time error 13 Type Mismatch"

    can u help me to solve this problem plz

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: For each Method

    That looks rather like VB6 code. Are you sure that you've posted to the correct forum?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Re: For each Method

    oops.. sorry wrong forum..

  4. #4

    Thread Starter
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Re: For each Method

    oops sorry wrong forum.

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: For each Method

    Moved to the VB6 forum.

  6. #6
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: For each Method

    try this too
    Code:
    Dim t As Control
    For Each t In Me.Controls
        If TypeOf t Is TextBox Then
            t.Text = "TEST"
        End If
    Next
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  7. #7

    Thread Starter
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Re: For each Method

    Quote Originally Posted by seenu_1st View Post
    try this too
    Code:
    Dim t As Control
    For Each t In Me.Controls
        If TypeOf t Is TextBox Then
            t.Text = "TEST"
        End If
    Next

    thx for solved my problem..
    how to mark this thread as solved thread ???

  8. #8
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: For each Method

    click thread tools > Mark thread resolved, above the 1st post.
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  9. #9

    Thread Starter
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Re: For each Method

    Quote Originally Posted by seenu_1st View Post
    click thread tools > Mark thread resolved, above the 1st post.
    thx ,,,

Tags for this Thread

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