Results 1 to 4 of 4

Thread: [RESOLVED] simple if then statement help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    87

    Resolved [RESOLVED] simple if then statement help

    I need help with a very simple if/then statment

    i need:

    when i click command1 do this\/

    if text1 HAS text then text2.text = "text"

    if text1 DOES NOT have text then text2.text = "none"
    Last edited by Hack; Apr 6th, 2009 at 05:56 AM. Reason: different question - Added RESOLVED to thread title and green resolved checkmark

  2. #2
    Hyperactive Member
    Join Date
    May 2007
    Posts
    278

    Re: simple if then statement help

    Code:
    Private Sub Command1_Click()
    
    If Text1.Text = vbNullString Then
    Text2.Text = "nothing"
    Else
    Text2.Text = "something"
    End If
    
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    87

    Re: simple if then statement help

    Thank You Thank You Thank You!!!!!!!!!!!!!

  4. #4
    PowerPoster Code Doc's Avatar
    Join Date
    Mar 2007
    Location
    Omaha, Nebraska
    Posts
    2,354

    Re: simple if then statement help

    You may want to check for useless space bar presses:
    Code:
    If Trim(Text1.Text) = vbNullString Then
        Text2.Text = "text"
    Else Text2.Text = "none"
    End If
    Doctor Ed

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