我正在尝试将数据从文本框输入到数据表,但我似乎无法让它正常工作。我尝试过变量、对象、数组和子程序。提到的都没有解决。
该程序只是一个图表生成器,它从 5 个文本框中获取 5 个变量并将它们输入到数据表中以填充折线图。
Dim dtTest As New DataTable
Dim a As Integer
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
dtTest.Columns.Add("Grades", GetType(Integer))
dtTest.Columns.Add("Exams", GetType(Integer))
dtTest.Rows.Add(1, a) // **it wont work with variables**
dtTest.Rows.Add(2, 80) //
dtTest.Rows.Add(3, 60)
dtTest.Rows.Add(4, 90)
dtTest.Rows.Add(5, 70)
With Chart1.ChartAreas(0)
.AxisX.Minimum = 0
.AxisX.Maximum = 6
.AxisY.Minimum = 50
.AxisY.Maximum = 100
.AxisY.Interval = 10
.AxisX.Title = "Grades"
.AxisY.Title = "Exams"
End With
End Sub
任何帮助将不胜感激