Using scrollbars
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Hey what is the code for scrollbars both V and H for scrolling a panel or something else like in a listbox or a multiline textbox?
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

This would switch selected items in a listbox:
Code: Select all
And this would scroll lines in a textbox:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HScrollBar1.LargeChange = 1
HScrollBar1.Maximum = ListBox1.Items.Count - 1
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
ListBox1.SelectedIndex = HScrollBar1.Value
End Sub
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
VScrollBar1.LargeChange = 1
End Sub
Private Sub VScrollBar1_Scroll_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
If TextBox1.Text.Length > 0 Then
Dim lineStarts As List(Of Integer) = New List(Of Integer)
For i As Integer = 0 To TextBox1.Text.Length - 2
If TextBox1.Text.Substring(i, 2) = vbCrLf Then
lineStarts.Add(i)
End If
Next
VScrollBar1.Maximum = lineStarts.Count
If VScrollBar1.Value < lineStarts.Count Then
TextBox1.SelectionStart = lineStarts(VScrollBar1.Value)
Else
TextBox1.SelectionStart = TextBox1.Text.Length
End If
TextBox1.ScrollToCaret()
End If
End Sub
Dude thanks!! You own at coding :!!!!
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!
![Image]()
![Image]()
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;
Over 30 projects with source code!
Please give reputation to helpful members!

5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023