We Recommend

Beginning VB.NET Beginning VB.NET
Visual Basic .NET is the latest version of the most widely used programming language in the world, popular with professional developers and complete beginners alike. This book will teach you Visual Basic .NET from first principles. You'll quickly and easily learn how to write Visual Basic .NET code and create attractive windows and forms for the users of your applications.


Posted By

rini on 03/17/08


Tagged


Versions (?)


how to create a dynamic scrollbar & frame in vb.net?


Published in: VB.NET 


plz help me with the source code.............


  1. Private Sub Form_Load()
  2. ' Set frame's height to the "virtual screen size (500 items)"
  3. Frame1.Height = Label1(0).Height * 500
  4. ' Set scroll bar parameters (0-499)
  5. VScroll1.Max = 499
  6. VScroll1.Min = 0
  7. ' Create (or place) the 500 items -- labels in this case
  8. For i = 1 To 499
  9. Load Label1(i)
  10. Label1(i).Top = Label1(0).Height * i
  11. Label1(i).Caption = i
  12. Label1(i).Visible = True
  13. Next
  14. End Sub
  15.  
  16. Private Sub Form_Resize()
  17. Frame1.Width = ScaleWidth - VScroll1.Width
  18. VScroll1.Left = Frame1.Width
  19. VScroll1.Height = ScaleHeight
  20. End Sub
  21.  
  22. Private Sub VScroll1_Change()
  23. ' Calculate the new top of the frame as a negative number
  24. Frame1.Top = -Label1(0).Height * VScroll1.Value
  25. End Sub

Report this snippet 

You need to login to post a comment.