Results 1 to 2 of 2

Thread: please help... what is wrong with my code?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    128

    please help... what is wrong with my code?

    this is an example provided by teeChart v5.0.4 (written in C#)
    i have used a C# to VB Translator and the code it came up doesn't work?

    what is wrong? please help...


    PHP Code:
    Imports System
    Imports System
    .Collections
    Imports System
    .ComponentModel
    Imports System
    .Data
    Imports System
    .Drawing
    Imports System
    .IO
    Imports Steema
    .TeeChart
    Imports System
    .Web
    Imports System
    .Web.SessionState
    Imports System
    .Web.UI
    Imports System
    .Web.UI.WebControls
    Imports System
    .Web.UI.HtmlControls

    Public Class ShowSeries
        Inherits System
    .Web.UI.Page
        
    Protected Image1 As System.Web.UI.WebControls.Image

    #Region " Web Form Designer Generated Code "

        
    Private Sub InitializeComponent()
            
    Me.Load += New System.EventHandler(Me.Page_Load)

        
    End Sub
        
    Protected Overrides Sub OnInit(ByVal e As EventArgs)
            
    InitializeComponent()
            
    MyBase.OnInit(e)
        
    End Sub

    #End Region

        
    Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
            Dim webServer 
    As String Session("hostname")
            
    Dim seriesType As String
            Dim viewType 
    As String
            seriesType 
    "Line"
            
    viewType "False"
            
    Image1.ImageUrl "http://" webServer "/ReportClient/Reg/ShowSeries.aspx?seriestype=" seriesType "&view=" viewType
        End Sub

    End 
    Class 

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    This is C# code:
    PHP Code:
    Me.Load += New System.EventHandler(Me.Page_Load
    and won't work in VB.NET. The converter should have removed this being that it new to create the VB.NET version which is:
    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Remove that Me.Load line and it should work(or at least compile). Oh, and the error i got when I checked to make sure I wasn't posting a lie was:
    Code:
    C:\Inetpub\wwwroot\WebForm1.aspx.vb(12): 
    'Public Event Load(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. 
    Use a 'RaiseEvent' statement to raise an event.
    ...and that was caused when I stuck this line in InializeComponent:
    VB Code:
    1. MyBase.Load += New System.EventHandler(AddressOf Page_Load)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width