0
我想排序我的Datagridview取決於文本中的文本,但只要我把它放在一個字母它引發一個空指針。是由Visual Studio 2013年我datagridview數據源拋出一個空指針參考
這裏產生的datagridview的是我的代碼:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KoolenEnKoolenApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void debiteurBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.debiteurBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.knkDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'knkDataSet.Debiteur' table. You can move, or remove it, as needed.
this.debiteurTableAdapter.Fill(this.knkDataSet.Debiteur);
}
private void debiteurDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
try
{
debiteurDataGridView.Rows[e.RowIndex].ReadOnly = true;
}
catch (Exception)
{
Console.Out.WriteLine("er is een error opgetreden");
}
}
private void tbZpk_TextChanged(object sender, EventArgs e)
{
(debiteurBindingSource.DataSource as DataTable).DefaultView.RowFilter = "Zpk like '%" + tbZpk.Text + "%'";
}
}
}
使用調試器盧克 – ne1410s