Page 1 of 1

How to convert the c# to vb for this statement?

Posted: Wed Nov 15, 2006 3:39 am
by 9642531
Hi,

I'm refering to Tutorial 10 - Walkthrough ASP.NET example and is trying to code in VB.
Can someone help me to convert this C# statement to VB?

zoomedState=((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request,zoomedState);

I try code:
Dim zoomTool As Steema.TeeChart.Tools.ZoomTool = New Steema.TeeChart.Tools.ZoomTool
zoomTool = wChart.Chart.Tools(0)

but failed.

Posted: Wed Nov 15, 2006 5:30 am
by 9642531
I tried this code,

zoomedState = CType(wChart.Chart.Tools(0), Steema.TeeChart.Tools.ZoomTool).SetCurrentZoom(Request, zoomedState)

but still "the specified cast is not valid"

Posted: Wed Nov 15, 2006 9:42 am
by narcis
Hi sherlyn,

The VB.NET equivalent of the CheckZoom method is this:

Code: Select all

    Private Sub CheckZoom(ByVal wChart As WebChart)
        Dim zoomedState As ArrayList = CType(Session(wChart.ID + "Zoomed"), ArrayList)
        zoomedState = (CType(wChart.Chart.Tools(0), Steema.TeeChart.Tools.ZoomTool)).SetCurrentZoom(Request, zoomedState)
        If zoomedState Is Nothing Then
            Session.Remove(wChart.ID + "Zoomed")
        Else
            Session.Add(wChart.ID + "Zoomed", zoomedState)
        End If
    End Sub
To help you translate C# to VB.NET code and viceversa you can use one those tools:

http://carlosag.net/Tools/CodeTranslator/Default.aspx
http://www.kamalpatel.net/ConvertCSharp2VB.aspx