I'm trying to create a windows form application using .NET 2003
Specifically I'm trying to create a scrollable portion within my form. This
portion is to be populated with what is in effect a table (or more
specifically a contact list) which is taken from a webservice.
Ideally i want to be able to scroll through the list of clickable elements
which would then open a new form when clicked.
My knowledge of windows forms is very poor as I've dealt mainly with ASP.NET
for last year so try to explain any ideas as fully as you can.
So far i've created a label control and a HScroll bar. If I set the label
AutoSize to false, the label does not scroll to the elements which appear
outside of the region, if i set the autosize to true, for some reason only
the first line is displayed.
Code:Private Sub frmMainForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim hsb As Single = CSng(scrlVerticalScroll.Height - lblContactList.Height)
Dim ticks As Single = CSng(scrlVerticalScroll.Maximum -
scrlVerticalScroll.Minimum)
vScrollMultiplier = hsb / ticks
End Sub
Code: Private Sub scrlVerticalScroll_Scroll(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.ScrollEventArgs) Handles
scrlVerticalScroll.Scroll
vAbsPos = CSng(scrlVerticalScroll.Value - scrlVerticalScroll.Minimum)
lblContactList.Top = scrlVerticalScroll.Bottom -
CInt(vScrollMultiplier * vAbsPos) - lblContactList.Height
End Sub
Code:Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogin.Click
'Snip
Dim ContactRow As DataRow
lblContactList.Text = ""
For Each ContactRow In DataSet.Tables(0).Rows
lblContactList.Text &= ContactRow.Item(0) &
ContactRow.Item(1) & vbCrLf
MsgBox(ContactRow.Item(0))
Next
lblContactList.AutoSize = True
End If
End Sub
Thanks in Advance,

Signature
=============
VB .NET Developer
http://www.rocketscience.uk.com
Bob Powell [MVP] - 19 Jan 2006 18:30 GMT
I think you'd be better off populating a ListView with your contact info and
responding to the SelectedIndexChanged and / or DoubleClick events.
If you need a specific look for you contact info consider a ListView with
one column and do your own custom item drawing.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> I'm trying to create a windows form application using .NET 2003
>
[quoted text clipped - 51 lines]
>
> Thanks in Advance,