4 Replies - 1006 Views - Last Post: 29 May 2012 - 08:48 AM Rate Topic: -----

#1 apakhe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-March 12

Question: How to make TextBox2.Text display <Words>

Posted 29 May 2012 - 08:08 AM

Hi!

My Question: How to make TextBox2.Text displaythe same text if in TextBox1.Text i have, lets say "Test" on my first button click and "test" on my second. I want to make it do so without having to write the code again:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "Test" Then
            TextBox2.Text = "Random Random Random"         
        Else
            TextBox2.Text = "Other Random"          
        End If

        If TextBox1.Text = "test" Then
            TextBox2.Text = "Same Random Random Random"         
        Else
            TextBox2.Text = "Same Other Random"          
        End If



    End Sub





Thank You!

Is This A Good Question/Topic? 0
  • +

Replies To: Question: How to make TextBox2.Text display <Words>

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8374
  • View blog
  • Posts: 31,122
  • Joined: 12-June 08

Re: Question: How to make TextBox2.Text display <Words>

Posted 29 May 2012 - 08:11 AM

What? Please explain that again.
Was This Post Helpful? 0
  • +
  • -

#3 b2.f2  Icon User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 76
  • Joined: 21-May 07

Re: Question: How to make TextBox2.Text display <Words>

Posted 29 May 2012 - 08:16 AM

View Postapakhe, on 29 May 2012 - 09:08 AM, said:

Hi!

My Question: How to make TextBox2.Text displaythe same text if in TextBox1.Text i have, lets say "Test" on my first button click and "test" on my second. I want to make it do so without having to write the code again:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "Test" Then
            TextBox2.Text = "Random Random Random"         
        Else
            TextBox2.Text = "Other Random"          
        End If

        If TextBox1.Text = "test" Then
            TextBox2.Text = "Same Random Random Random"         
        Else
            TextBox2.Text = "Same Other Random"          
        End If



    End Sub





Thank You!


So you want to have 1 button click handler for 2 buttons??
then you just add the secont button click on same event like this.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ,Button2.Click
        If TextBox1.Text = "Test" Then
            TextBox2.Text = "Random Random Random"         
        Else
            TextBox2.Text = "Other Random"          
        End If

        If TextBox1.Text = "test" Then
            TextBox2.Text = "Same Random Random Random"         
        Else
            TextBox2.Text = "Same Other Random"          
        End If



    End Sub


Hard to understand what you mean.
Was This Post Helpful? 0
  • +
  • -

#4 apakhe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-March 12

Re: Question: How to make TextBox2.Text display <Words>

Posted 29 May 2012 - 08:19 AM

I want to make a dictionary program, and like in Google searches you don't always type "Dog", you may also type "dog". Ok... lets say I make my program to search for Dog(TextBox1.Text = "Dog") and i want to display something in TextBox2.Text(TextBox2.Text = "A dog is ..."), but when i type "dog" without capital D, it doesnt display anything.

For that i have to write the code again and but "dog" instead of "Dog".
How can that be fiexed?
Was This Post Helpful? 0
  • +
  • -

#5 ninjatalon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 16-January 11

Re: Question: How to make TextBox2.Text display <Words>

Posted 29 May 2012 - 08:48 AM

View Postapakhe, on 29 May 2012 - 08:19 AM, said:

I want to make a dictionary program, and like in Google searches you don't always type "Dog", you may also type "dog". Ok... lets say I make my program to search for Dog(TextBox1.Text = "Dog") and i want to display something in TextBox2.Text(TextBox2.Text = "A dog is ..."), but when i type "dog" without capital D, it doesnt display anything.

For that i have to write the code again and but "dog" instead of "Dog".
How can that be fiexed?


Don't really understand your situation but You should be using Textbox1.Text.Equals("dog") not Textbox1.Text="dog"
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1