Daniel Ribeiro 0 Posted March 28, 2019 Report Share Posted March 28, 2019 (edited) Como consigo programar estes botões que são criados dinamicamente ? Ou informação sobre criação de botões dinâmicos Private Sub compra_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Width = pagina_inicial.Width - 1 Me.Height = pagina_inicial.Height - 1 Dim objConexao As SqlClient.SqlConnection objConexao = New SqlClient.SqlConnection() objConexao.Open() '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Dim num_total_pedidos As Integer Dim sql As New SqlCommand("SELECT count (*) FROM tbl_pedidos", objConexao) num_total_pedidos = sql.ExecuteScalar() Dim i, k, x, y As Integer x = 63 y = 20 For i = 1 To num_total_pedidos ' For k = 1 To 4 Dim btn As New Button ' btn.Location = New Point(x, y) btn.Width = 100 btn.Height = 100 btn.Text = "" btn.Visible = True FlowLayoutPanel1.Controls.Add(btn) btn.Name = "btn" & i MsgBox("btn" & i) ' x = x + 150 ' Next ' x = 63 ' y = 150 Next objConexao.Close() End Sub Edited March 28, 2019 by Daniel Ribeiro Link to post Share on other sites
Gnrtuga 21 Posted March 28, 2019 Report Share Posted March 28, 2019 Boas, vê este tópico https://stackoverflow.com/questions/566770/assign-on-click-vba-function-to-a-dynamically-created-button-on-excel-userform pode ser que ajude Férias! Estou por aqui: http://maps.google.p...001549&t=h&z=20 (a bulir claro está!) Nunca mais é verão outra vez.. Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now