position a hyperlink

  • Thread starter Thread starter raemdop
  • Start date Start date
R

raemdop

Guest
hi,

I have some code where I create an array of hyperlinks and put them on a webform. Is there a way to position the Hyperlinks on this webform, because they are all one 1 horizontal line on top of the page.

Thanks for reading my problem
Raemdop

Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here

        Dim sid() As HyperLink

        Dim i As Integer

        For i = 0 To 100

            Dim hl As New HyperLink()
            ReDim sid(i)

            hl.NavigateUrl = "targetPage.aspx"
            hl.Text = "test"

            sid(i) = hl

            'this does not work !!!!!!!!!!!!!!!!

            sid(i).Style.Item("top") = 100 + i

            sid(i).Style.Item("left") = 50

            Me.Controls.Add(sid(i))

        Next i

    End Sub
 
Because you're only increasing the loop by one, you're only setting it to one pixel above the hyperlink before it (100 + i). I suggest you multiply "i" by something to move the link down on the page more, maybe something like this:
Code:
            sid(i).Style.Item("top") = 100 + (i * 20)
That example will put the hyperlink 20 pixels below the last one. You might have to increase the number you're multiplying by to get them in the right position.

HTH

And yes Robby, this is VB.NET. (actually ASP.NET, but it's close enough) :)
 
Back
Top