カテゴリをデータからフィルタリングするには、以下の手順を実行します。


Visual Basic コードの書き方
| Visual Basic |
コードのコピー
|
|---|---|
Private Sub listBox1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles listBox1.SelectedIndexChanged
If listBox1.SelectedIndex >= 0 Then
Dim categoryID As String = Me.categoriesDataSet1.Categories(listBox1.SelectedIndex).CategoryID.ToString()
Me.dataView1.RowFilter = "CategoryID = " + categoryID
Me.c1Chart1.Header.Text = listBox1.Text
End If
End Sub
|
|
C# コードの書き方
| C# |
コードのコピー
|
|---|---|
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (listBox1.SelectedIndex >= 0)
{
string categoryID = this.categoriesDataSet1.Categories[listBox1.SelectedIndex].CategoryID.ToString();
this.dataView1.RowFilter = "CategoryID = " + categoryID;
this.c1Chart1.Header.Text = listBox1.Text;
}
}
|
|
グラフへのデータのバインドは正常に完了しました。次の手順では、グラフの外観に変更を加えます。
