未将对象引用设置到对象的实例。这个就是找不到原因。。。
Dim Chart As WinForm.Chart '定义一个图表变量
Dim Series As WinForm.ChartSeries '定义一个图系变量
Dim tbl As DataTable = DataTables("订单") '定义一个变量tbl引用数据表
Dim lst As New List(Of String)
lst.Add( "00:00")
lst.Add( "01:00")
lst.Add( "02:00")
lst.Add( "03:00")
lst.Add( "04:00")
lst.Add( "05:00")
lst.Add( "06:00")
lst.Add( "07:00")
lst.Add( "08:00")
lst.Add( "09:00")
lst.Add( "10:00")
lst.Add( "11:00")
lst.Add( "12:00")
lst.Add( "13:00")
lst.Add( "14:00")
lst.Add( "15:00")
lst.Add( "16:00")
lst.Add( "17:00")
lst.Add( "18:00")
lst.Add( "19:00")
lst.Add( "20:00")
lst.Add( "21:00")
lst.Add( "22:00")
lst.Add( "23:00")
Chart = e.Form.Controls("Chart1") ' 引用窗口中的图表
Chart.SeriesList.Clear() '清除图表原来的图系
Series = Chart.SeriesList.Add() '增加一个图系
Dim s As String = "2022-08-10 "
Series.Length = lst.Count '设置图系的长度
For i As Integer = 0 To 23'指定每个数据点的位置
Series.X(i) = i '指定水平坐标
Series.Y(i) = tbl.Find("用户 = '张三' and 时间=#" & s & " " & lst(i) & "#") '指定垂直坐标
Chart.AxisX.SetValueLabel(i, lst(i)) '指定字符表示
Next
Chart.AxisX.AnnoWithLabels = True '启用字符标示