add and remove buttons

Started by nandagopal, May 18, 2009, 09:47 PM

previous topic - next topic
Go Down

nandagopal

When the user clicks the Add button, the program uses Load to add a new button to the cmdButton control array. It sets the new button's Container so it is in the same PictureBox as the other buttons. It then calls subroutine SetScrollBar to adjust the buttons' scroll bar.


Code: [Select]
Private Sub cmdAdd_Click()
Dim new_index As Integer

    new_index = cmdButton.UBound + 1
    Load cmdButton(new_index)
    cmdButton(new_index).Move _
        cmdButton(new_index - 1).Left, _
        cmdButton(new_index - 1).Top + cmdButton(new_index _
            - 1).Height + 120
    cmdButton(new_index).Container = _
        cmdButton(new_index - 1).Container
    cmdButton(new_index).Visible = True
    cmdButton(new_index).Caption = "Button " & _
        Format$(new_index)

    SetScrollBar
End Sub

Private Sub SetScrollBar()
    ' Size the inner PictureBox.
    InnerPict.Height = cmdButton(cmdButton.UBound).Top + _
        cmdButton(cmdButton.UBound).Height + 120

    ' See if we need the scroll bar.
    If InnerPict.Height <= OuterPict.ScaleHeight Then
        InnerPict.Move 0, 0
        VBar.Visible = False
    Else
        ' Set scroll bar properties.
        VBar.Min = 0
        VBar.Max = OuterPict.ScaleHeight - InnerPict.Height
        VBar.LargeChange = OuterPict.ScaleHeight
        VBar.SmallChange = OuterPict.ScaleHeight / 5
        VBar.Visible = True
    End If
End Sub


When the user clicks the Remove button, the program unloads the most recently created button from the control array. It then calls subroutine SetScrollBar to adjust the buttons' scroll bar.


Private Sub cmdRemove_Click()
    If cmdButton.UBound < 1 Then Exit Sub

    Unload cmdButton(cmdButton.UBound)
    SetScrollBar
End Sub



dhoni

with this using easy program the .net should easy to solve
this program will use for add and remove button in .net

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Kids Memories Writing :: Book Website @ 349 Rs monthly
Copyright 2005 - 2020 :: IT Acumens :: All Rights Reserved. :: Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Dedicated Server