PDA

Click to See Complete Forum and Search --> : please help... what is wrong with my code?


tmashley
Feb 3rd, 2003, 12:01 PM
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...



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.Object, ByVal e As System.EventArgs) Handles 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

pvb
Feb 8th, 2003, 07:21 PM
This is C# 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:
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:
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:
MyBase.Load += New System.EventHandler(AddressOf Page_Load)