How to make a Button that can change the function of another button

A Button that can change the function of another buttton

Page 1 of 1

11 Replies - 2334 Views - Last Post: 01 September 2009 - 04:39 PM Rate Topic: -----

#1 SexySquirrel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 97
  • Joined: 30-August 09

How to make a Button that can change the function of another button

Post icon  Posted 30 August 2009 - 03:03 PM

Hello everyone. I have a button that will type a message saying 'hello' in a message box, (if clicked on). And I want to know how to make another one that will change it to say 'Hello Word' (when clicked on :D ).

Here is my code

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hello.Click
		Message.Text = "Hello."
	End Sub

	Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeToHelloWorld.Click
		 
	End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: How to make a Button that can change the function of another button

#2 Dilerious  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 2
  • View blog
  • Posts: 280
  • Joined: 30-December 05

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 03:08 PM

you'd simply have


	Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeToHelloWorld.Click
		 message.text = "Hello World"
	End Sub


Was This Post Helpful? 0
  • +
  • -

#3 Joshdw  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 225
  • Joined: 23-March 09

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 03:21 PM

I think he means he wants button 3 to change button 1's text apear diferent when clicked on.

You could do that with BOOLEAN
	   Dim popup As Boolean
		popup = False
		If popup = True Then
			Message.Text = "Hello World."
		ElseIf popup = False Then
			Message.Text = "Hello."
		End If

Was This Post Helpful? 0
  • +
  • -

#4 SexySquirrel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 97
  • Joined: 30-August 09

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 06:25 PM

Almost...I want button 3 (when clicked on) to change text of button 1 (when clicked on)

For example:

Button 1 will type 'Hello' into the message box.
And I want button 3 to change button 1's message to 'Hello World' so when I click on button 1 it will say 'Hello World' because button3 changed it..
Was This Post Helpful? 0
  • +
  • -

#5 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 50
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 06:34 PM

Well, this is a way of doing it.

At the top of the Form Class Dim Message1 As String = "Hello". Creates a Variable called Message1 and sets the default value to "Hello"

Button 1 MessageBox.Show(Message1). Display "Message1"

Button 3 Message1 = "Hello World". Set "Message1" to "Hello World"

Did you want the buttons caption to change as well?

This post has been edited by PDUNZ: 30 August 2009 - 06:38 PM

Was This Post Helpful? 0
  • +
  • -

#6 SexySquirrel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 97
  • Joined: 30-August 09

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 06:55 PM

Dam sorry everyone I meant to type 'Text Box' not 'Message Box'

Here's my post with the correct words :(


Almost...I want button 3 (when clicked on) to change text of button 1 (when clicked on)

For example:

Button 1 will type 'Hello' into the text box.
And I want button 3 to change button 1's message to 'Hello World' so when I click on button 1 it will say 'Hello World' in the text box.


Again sorry for my incorrect words. :(
Was This Post Helpful? 0
  • +
  • -

#7 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 50
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 07:04 PM

Ok, then you would use something like textbox1.text = Message1 for button 1 (going from my code above).

This post has been edited by PDUNZ: 30 August 2009 - 07:05 PM

Was This Post Helpful? 0
  • +
  • -

#8 SexSquirrel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 19-August 09

Re: How to make a Button that can change the function of another button

Posted 30 August 2009 - 08:57 PM

Ok thanks, oh and btw how would I make a button that will make a textbox appear and changes the button's text that appears on the text box to whatever the input is? I'll be sure to thank you.
Was This Post Helpful? 0
  • +
  • -

#9 SexySquirrel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 97
  • Joined: 30-August 09

Re: How to make a Button that can change the function of another button

Posted 31 August 2009 - 12:30 AM

View PostPDUNZ, on 30 Aug, 2009 - 06:04 PM, said:

Ok, then you would use something like textbox1.text = Message1 for button 1 (going from my code above).


What is Message1??
Was This Post Helpful? 0
  • +
  • -

#10 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 50
  • View blog
  • Posts: 376
  • Joined: 17-July 09

Re: How to make a Button that can change the function of another button

Posted 31 August 2009 - 12:48 AM

Message1 is just a name of a string variable I used to store a string which in this case is Hello and Hello World - Dim Message1 As String = "Hello".

Have a look in the Tutorials and Snippets section and you will see most with have "Dim....As......".

This post has been edited by PDUNZ: 31 August 2009 - 12:54 AM

Was This Post Helpful? 1
  • +
  • -

#11 SexySquirrel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 97
  • Joined: 30-August 09

Re: How to make a Button that can change the function of another button

Posted 01 September 2009 - 12:34 AM

What about button 3 "POUNZ"??

Nevermind..I reread the top

This post has been edited by SexySquirrel: 01 September 2009 - 12:41 AM

Was This Post Helpful? 0
  • +
  • -

#12 SexySquirrel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 97
  • Joined: 30-August 09

Re: How to make a Button that can change the function of another button

Posted 01 September 2009 - 04:39 PM

Alright, thanks for all your help, POUNZ

You're going to get thanked :)

This post has been edited by SexySquirrel: 01 September 2009 - 04:49 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1