unfortunately it is a windows app, specifically reading data from external hardware connected to a serial port, I have all of the other code working and can very crudely display the data (you don't want to know it's too cringeworthy) to finish this off I just need to get this data displayed neatly.
cheers 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
