One day life will be simple ....

... in the meantime.

Yes I need to filter the array such that only the elements in array
that I have actually written real data to are displayed in the
datagridview (I know this by looking at the alive flag), in this case
it should be simple as I have a count of how many array elements I
have written to, but I can't see  how I can dynamically update the
size of the datagridview.

thanks

Mark

On Sep 22, 6:19 pm, Cerebrus <[email protected]> wrote:
> You're welcome!
>
> Do you mean that you need to *filter* the Array so as to select only a
> few items out of the presumed total (256, I presume) ? If so, you can
> use the projection extensions available via IEnumerable<T> or simply
> use Array.Find<T> and supply your selection predicate.
>
> On Sep 22, 2:49 pm, Markarina <[email protected]> wrote:
>
>
>
> > okay did the changes anyway and now have data displaying, all I need
> > to do now is to be able to select the data I want to display, rather
> > than have all the data display all the time.
>
> > cheers for the help
>
> > Mark
>
> > On Sep 22, 9:05 am, Cerebrus <[email protected]> wrote:
>
> > > You haven't specified if this is a Windows app or Web. I'll assume
> > > that it's a Web app and you want to load data into a GridView. I avoid
> > > wizards (unless they're human!) so I can't tell you how to do it using
> > > the Datasource configuration wizard. But here's a simple sample (C#
> > > 3.x syntax) :
>
> > > Step1: Promote the public fields to public properties:
> > > ---
> > > public struct VmsData
> > > {
> > >   public byte VmsID {get; set;}
> > >   public double Volt1 { get; set; }
> > >   public double Volt2 { get; set; }
> > >   public double Volt3 { get; set; }
> > >   public double Volt4 { get; set; }
> > >   ...
> > >   ...}
>
> > > ---
>
> > > Step 2: Binding :
> > > ---
> > > ASPX Markup :
> > > <asp:GridView ID="grid1" runat="server" AutoGenerateColumns="true" />
>
> > > Code :
> > > VmsData[] vmsArray = new VmsData[2]
> > > {
> > >   new VmsData {VmsID = 1, Volt1 = 1.0D, Volt2 = 2.0D, Volt3 = 3.0D,
> > > Volt4 = 4.0D, CycleCounter = 1, OTPCounter = 1, OVPCounter = 1,
> > > LVPCounter = 1, Temperature = 98.6D, Alive = true, Tries = 1},
> > >   new VmsData {VmsID = 2, Volt1 = 1.0D, Volt2 = 2.0D, Volt3 = 3.0D,
> > > Volt4 = 4.0D, CycleCounter = 2, OTPCounter = 2, OVPCounter = 2,
> > > LVPCounter = 2, Temperature = 37.0D, Alive = false, Tries = 2}
>
> > > };
>
> > > grid1.DataSource = vmsArray;
> > > grid1.DataBind();
> > > ---
>
> > > On Sep 22, 3:19 am, Markarina <[email protected]> wrote:
>
> > > > Hmm get the idea but can't seem to get it quite right ... here is what
> > > > I have
>
> > > >         public struct VmsData
> > > >         {
> > > >             public byte VmsID;
> > > >             public double Volt1;
> > > >             public double Volt2;
> > > >             public double Volt3;
> > > >             public double Volt4;
> > > >             public int CycleCounter;
> > > >             public int OTPCounter;
> > > >             public int OVPCounter;
> > > >             public int LVPCounter;
> > > >             public double Temperature;
> > > >             public bool Alive;
> > > >             public int tries;
> > > >         }
> > > >         public VmsData [] VmsArray = new VmsData[256];
>
> > > > but when I try and point the datasource to VmsArray all I see is
> > > > VmsData when I try and do the binding using the data source
> > > > configuration wizard.
>
> > > > cheers
>
> > > > Mark- Hide quoted text -
>
> > - Show quoted text -

Reply via email to