Click here to Skip to main content
16,005,826 members
Home / Discussions / C#
   

C#

 
QuestionC# library for file system info? Pin
KingTermite16-Jul-03 5:24
KingTermite16-Jul-03 5:24 
GeneralDynamic Array Pin
Hoang Dung16-Jul-03 4:46
Hoang Dung16-Jul-03 4:46 
GeneralRe: Dynamic Array Pin
Frank Olorin Rizzi16-Jul-03 4:54
Frank Olorin Rizzi16-Jul-03 4:54 
GeneralRe: Dynamic Array Pin
Meysam Mahfouzi16-Jul-03 6:26
Meysam Mahfouzi16-Jul-03 6:26 
GeneralThanks Pin
Hoang Dung17-Jul-03 7:22
Hoang Dung17-Jul-03 7:22 
Generalexamples UI datagrid/collection Pin
haezeban16-Jul-03 4:15
haezeban16-Jul-03 4:15 
GeneralCopy, Paste and Find Pin
totig16-Jul-03 3:00
totig16-Jul-03 3:00 
GeneralWhat's the question Pin
ResCode15-Jul-03 16:26
ResCode15-Jul-03 16:26 
Sleepy | :zzz: Confused | :confused:
the IDE notes that :
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll

All codes are bellow:
//-------------------------------------------------


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace test
{
///
/// Summary description for Form1.
///

public class Form1 : System.Windows.Forms.Form
{
private DataTable _table=null;
private DataView _view1=null;
private DataView _view2=null;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.DataGrid dataGrid2;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
init();
}
private void init()
{
DataColumn C1=new DataColumn("id",typeof(int));
C1.AutoIncrement=true;
DataColumn C2=new DataColumn("name",typeof(string));
DataColumn C3=new DataColumn("age",typeof(int));
this._table=new DataTable("Student");
_table.Columns.Add(C1);
_table.Columns.Add(C2);
_table.Columns.Add(C3);
_view1=new DataView(_table);
_view2=new DataView(_table);
this.dataGrid1.DataSource=_view1;
this.dataGrid2.DataSource=_view2;

_view1.RowFilter="id<10";
_view2.RowFilter="id>=10";

_view1.ListChanged+=new ListChangedEventHandler(_view1_ListChanged);
}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(22, 15);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(255, 135);
this.dataGrid1.TabIndex = 0;
//
// dataGrid2
//
this.dataGrid2.DataMember = "";
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(288, 14);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.Size = new System.Drawing.Size(282, 138);
this.dataGrid2.TabIndex = 1;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(605, 319);
this.Controls.Add(this.dataGrid2);
this.Controls.Add(this.dataGrid1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void _view1_ListChanged(object sender, ListChangedEventArgs e)
{
try
{
_view1.ListChanged-=new ListChangedEventHandler(_view1_ListChanged);

if(e.ListChangedType==ListChangedType.ItemAdded)
{
_view1[e.NewIndex]["age"]=18;
}
_view1.ListChanged+=new ListChangedEventHandler(_view1_ListChanged);
}
catch(Exception Ex)
{
MessageBox.Show(Ex.ToString());
}
}
}
}
//-----------------------------------------------------
GeneralRe: What's the question Pin
ResCode16-Jul-03 18:18
ResCode16-Jul-03 18:18 
Generalmisterbear Pin
misterbear15-Jul-03 13:07
misterbear15-Jul-03 13:07 
GeneralRe: misterbear Pin
J. Dunlap15-Jul-03 13:57
J. Dunlap15-Jul-03 13:57 
GeneralC# CDO email Encoding HELP please Pin
Member 7681715-Jul-03 12:36
Member 7681715-Jul-03 12:36 
GeneralRe: C# CDO email Encoding HELP please Pin
Radoslav Bielik15-Jul-03 13:19
Radoslav Bielik15-Jul-03 13:19 
GeneralRe: C# CDO email Encoding HELP please Pin
Member 7681715-Jul-03 13:24
Member 7681715-Jul-03 13:24 
GeneralRe: C# CDO email Encoding HELP please Pin
Radoslav Bielik16-Jul-03 11:33
Radoslav Bielik16-Jul-03 11:33 
QuestionHow to execute an application from C# Pin
Darryl Borden15-Jul-03 10:23
Darryl Borden15-Jul-03 10:23 
AnswerRe: How to execute an application from C# Pin
David Stone15-Jul-03 10:41
sitebuilderDavid Stone15-Jul-03 10:41 
GeneralRe: How to execute an application from C# Pin
Stephane Rodriguez.16-Jul-03 2:20
Stephane Rodriguez.16-Jul-03 2:20 
GeneralRe: How to execute an application from C# Pin
David Stone16-Jul-03 7:08
sitebuilderDavid Stone16-Jul-03 7:08 
GeneralRe: How to execute an application from C# Pin
Stephane Rodriguez.16-Jul-03 8:04
Stephane Rodriguez.16-Jul-03 8:04 
GeneralRe: How to execute an application from C# Pin
David Stone16-Jul-03 11:14
sitebuilderDavid Stone16-Jul-03 11:14 
GeneralRe: How to execute an application from C# Pin
Stephane Rodriguez.16-Jul-03 19:15
Stephane Rodriguez.16-Jul-03 19:15 
GeneralRe: How to execute an application from C# Pin
David Stone17-Jul-03 5:41
sitebuilderDavid Stone17-Jul-03 5:41 
GeneralInvalidOperationException Pin
Kant15-Jul-03 9:09
Kant15-Jul-03 9:09 
GeneralRe: InvalidOperationException Pin
Kant15-Jul-03 9:34
Kant15-Jul-03 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.