⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.vb

📁 This ASP.NET (VB.NET) sample demonstrates how to create chart.
💻 VB
字号:
Partial Class _default
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    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
    End Sub

    Private Sub dpTipo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dpTipo.SelectedIndexChanged
        Dim valor As String = dpTipo.SelectedItem.Value
        Select Case valor
            Case "1"
                imgGrafico.Visible = True
                imgGrafico.ImageUrl = "GerarGrafico.aspx?xvalues=Compras tetsttet tettte|Vendas&yvalues=9|10&tipo_grafico=Barra"
            Case "2"
                imgGrafico.Visible = True
                imgGrafico.ImageUrl = "GerarGrafico.aspx?xvalues=Compras tetsttet tettte|Vendas&yvalues=600|1000&tipo_grafico=Pizza"
            Case "3"
                imgGrafico.Visible = True
                imgGrafico.ImageUrl = "GerarGrafico.aspx?xvalues=Compras tetsttet tettte|Vendas&yvalues=5600|1000&tipo_grafico=Barra2"
            Case "4"
                imgGrafico.Visible = True
                imgGrafico.ImageUrl = "GerarGrafico.aspx?tipo_grafico=Barra2&" + db()
            Case "5"
                imgGrafico.Visible = True
                imgGrafico.ImageUrl = "GerarGrafico.aspx?tipo_grafico=Pizza&" + db()
            Case Else
                imgGrafico.Visible = False
        End Select
    End Sub
    Function db() As String
        Dim da As New System.Data.SqlClient.SqlDataAdapter("select top 10 CustomerID ID,Freight TOTAL from Orders", "Data Source=127.0.0.1;User ID=sa;Password=;Initial Catalog=NorthWind")
        Dim dt As New DataTable
        da.Fill(dt)

        Dim i As Int32
        Dim xvalues As New System.Text.StringBuilder
        Dim yvalues As New System.Text.StringBuilder

        For i = 0 To dt.Rows.Count - 1
            If i <> 0 Then
                xvalues.Append("|")
                yvalues.Append("|")
            End If
            xvalues.Append(dt.Rows(i)(0))
            yvalues.Append(dt.Rows(i)(1))
        Next
        Return "xvalues=" + xvalues.ToString + "&" + "yvalues=" + yvalues.ToString

    End Function
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -