Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Buttons in VB


Message #1 by "OB" <oby.atabansi@h...> on Tue, 12 Mar 2002 18:44:28
This is a multi-part message in MIME format.

------=_NextPart_000_0030_01C1CA2D.487D6100
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

RE: [pro_vb] RE: Buttons in VBI would create the buttons as an array

Then the code would be as follow:

Private Sub Button1_Click(Index as Integer)
        Static lastButtonPressed as Integer
        Button1(lastButtonPressed).Enabled =3D True
        Button1(Index).Enabled =3D False
        lastButtonPressed=3DIndex
End sub

This code would disable only the last button pressed.
  ----- Original Message -----
  From: Atabansi, Oby P Ms IMCEN/EDS
  To: professional vb
  Sent: Tuesday, March 12, 2002 1:27 PM
  Subject: [pro_vb] RE: Buttons in VB


  Yeah but I have 12 buttons, each button enables different text and 
label objects.  The way I have it now, once I disable a button on click, 
then it stays like that.  Same thing for all the other buttons.  
Therefore, I have 12 buttons disabled on click.  My question is how do I 
enable all 12 buttons by toggling between them?  I am trying to avoid 
extensive coding by doing this:

  Private Sub Button1_Click
          Button2.Enabled =3D True
          Button3.Enabled =3D True
          Button4.Enabled =3D True
          Button5.Enabled =3D True
          Button6.Enabled =3D True
          ...
          Button1.Enabled =3D False
  End sub

  Private Sub Button2_Click
          Button1.Enabled =3D True
          Button3.Enabled =3D True
          Button4.Enabled =3D True
          Button5.Enabled =3D True
          Button6.Enabled =3D True
          ...
          Button2.Enabled =3D False
  End sub

  And so on...for each button.  Dont forget I have to enable and disable 
the 20 text boxes and 20 label boxes.  What the best approach?  Sorry, I 
am new to VB.



  -----Original Message-----
  From: Richard Lobel [mailto:richard@a...]
  Sent: Tuesday, March 12, 2002 2:13 PM
  To: professional vb
  Subject: [pro_vb] RE: Buttons in VB



  You don't need an if statement if you are using two buttons:

  Private Sub Button1_Click
          Button2.Enabled =3D True   'Turns the other button on
          Do the rest of your code
          Button1.Enabled =3D False  'Turns this button off
  End Sub

  Private Sub Button2_Click
          Button1.Enabled =3D True   'Turns the other button on
          Do the rest of your code
          Button2.Enabled =3D False  'Turns this button off
  End Sub

  This should work for you.

  Richard Lobel
  Accessible Data
  3805 S. 316th Street
  Auburn, WA 98001-3109
  richard@a...
  Tel:   (xxx) xxx-xxxx
  Fax:  (xxx) xxx-xxxx



  ***ORIGINAL MESSAGE***
  hey folks,   I need a sample code to enable and disable a button once 
it

  has been depressed.  Here is the scenario: 

  I need to toggle between 2 or more buttons.  What is the best 'If..
  Then..Else' statement to use?



$subst('Email.Unsub').

$subst('Email.Unsub').




_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




  Return to Index