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 -
