Greetings,

I have an array of DataGrid classes. Each DataGrid in the array needs to
handle the SizeChanged event.

How do I dynamically accomplish this using vb.net? In other words, how do I
programmatically set a handler for each DataGrid in the array?

Thanks!


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 08/01/2004

Re: DataGrid array by Lateralus

Lateralus
Thu Aug 05 20:45:31 CDT 2004

Roy,
The example I'm providing is in C# but it should be easily converted to
VB.Net. For example reasons I initialized the array to 2 elements.

private DataGrid[] dg = null;
private void InitDataGrids()
{
dg = new DataGrid[2];

for(int index = 0;index < dg.Length; index++)
{
dg[index].SizeChanged += new System.EventHandler(this.GridSizeChanged);
}
}

private void GridSizeChanged(object sender, EventArgs e)
{

//put code here for size changed event
}

HTH


"Roy Clemmons" <royclem@ev1.net> wrote in message
news:10h5gh7ict1bjed@corp.supernews.com...
> Greetings,
>
> I have an array of DataGrid classes. Each DataGrid in the array needs to
> handle the SizeChanged event.
>
> How do I dynamically accomplish this using vb.net? In other words, how do
I
> programmatically set a handler for each DataGrid in the array?
>
> Thanks!
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.732 / Virus Database: 486 - Release Date: 08/01/2004
>
>



Re: DataGrid array by Roy

Roy
Thu Aug 05 22:46:51 CDT 2004

> The example I'm providing is in C# but it
> should be easily converted to VB.Net.

C# is fine. I appreciate your quick response, thanks!

Roy


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 08/01/2004