Vb.net

Discussion in 'OT Technology' started by doggfather, Jun 16, 2006.

  1. doggfather

    doggfather New Member

    Joined:
    Aug 6, 2005
    Messages:
    224
    Likes Received:
    0
    <script runat="server" language="VB">
    Sub Main()
    Dim RandomClass As New Random()
    Dim RandomNumber As Integer
    RandomNumber = RandomClass.Next(1, 5)
    Response.Write(
    "<style> #banner {background: url('Pictures/Banner0" & RandomNumber & ".png') }</style>")
    End Sub
    </script>

    How do I call the Main() method? [my Page_Load() method is taken already]
     
  2. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Call Main
     
  3. doggfather

    doggfather New Member

    Joined:
    Aug 6, 2005
    Messages:
    224
    Likes Received:
    0
    Well that's what I asked, How do U call main?

    <scriptrunat="server"language="VB">
    Sub Main()
    Dim RandomClass AsNew Random()
    Dim RandomNumber AsInteger
    RandomNumber = RandomClass.Next(1, 5)
    Response.Write(
    "<style> #banner {background: url('Pictures/Banner0" & RandomNumber & ".png') }</style>")
    EndSub
    Main()
    </script>

    gives me an error
     
  4. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    main needs to be in somehwere like pageload
    Code:
    [COLOR=#0000ff]<[/COLOR][SIZE=2][COLOR=#800000]script[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]runat[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]="server"[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]language[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]="VB">
    Sub PageLoad(pageload args here)
    [/COLOR][/SIZE]   [SIZE=2][COLOR=#0000ff]Main()
    EndSub
    [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Main()
    [/SIZE]   [SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] RandomClass [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE] [SIZE=2]Random()[/SIZE][SIZE=2][COLOR=#0000ff]
    [/COLOR][/SIZE]   [SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] RandomNumber [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer
    [/COLOR][/SIZE]   [SIZE=2]RandomNumber = RandomClass.Next(1, 5)
    [/SIZE]   [SIZE=2] Response.Write([/SIZE][SIZE=2][COLOR=#800000]"<style> #banner {background: url('Pictures/Banner0"[/COLOR][/SIZE][SIZE=2] & [/SIZE]      [SIZE=2]RandomNumber & [/SIZE][SIZE=2][COLOR=#800000]".png') }</style>"[/COLOR][/SIZE][SIZE=2])
    [/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]
    [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]</[/COLOR][/SIZE][SIZE=2][COLOR=#800000]script[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]>[/COLOR][/SIZE]
    
     

Share This Page