From: giminera on
In a form I have a VScrollBar (bar1) and a FlowLayoutPanel (panel1)
I'm going to fill with buttons that correspond to data in a table in a
dataset (button and ds.Tables (1)). I wish I could disable the display
of the scrollbars FlowLayoutPanel but use the VScrollBar. Right now
they are only able to operate in parallel with the vertical scroll bar
of the combine and FlowLayoutPanel VScrollBar making them inherit the
values from the scroll inside the control FlowLayoutPanel. Thank
anyone can give me a solution. Basically I want to avoid the
AutoScroll but manage with a vertical scroll bar independent
(VScrollBar).
Attached below the code for filling the FlowLayoutPanel.
Hello.

Flow1.Controls.Clear()
ds.Tables.Clear()
Dim con As New OleDb.OleDbConnection
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =
C:\db1.mdb"
Try
con.Open()
sql = "SELECT * FROM portate WHERE tipo = 0"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "portate")
con.Close()
Dim intIndex As Integer
For intIndex = 0 To ds.Tables(0).Rows.Count - 1
Dim bottone As New Button
With bottone
..Size = New Size(103, 80)
..FlatStyle = FlatStyle.Standard
..Text = ds.Tables(0).Rows(intIndex).Item(0)
..ForeColor = Color.White
'.ImageList = ImageList1
'.ImageIndex = 0
'.BackColor = Color.Aqua
AddHandler bottone.Click, AddressOf btn_Click
End With
Flow1.Controls.Add(bottone)
Next
Flow1.AutoScroll = True
Bar1.LargeChange = Flow1.VerticalScroll.LargeChange
Bar1.SmallChange = Flow1.VerticalScroll.SmallChange
Bar1.Maximum = Flow1.VerticalScroll.Maximum
Catch es As Exception
MessageBox.Show(es.Message)
End Try
 | 
Pages: 1
Prev: Shared Sub Main
Next: VB.net Update Access