Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WinForm
I am doing school software project in windows application.in student marksheet loading
form i want to load the all the student marks for particular class at one instant
i am using datagrid to get the student name and subject.now i want to enter the
student marks within the datagrid and calculate the total and average.i don't know
how to enter the values dynamically in datagrid and insert it into the database.
 
i am using sqlserver 2005 as backend
 
if anyone have an idea share with me with some example code or link.
Posted 9-Mar-12 0:18am
Comments
Oshtri Deka at 9-Mar-12 5:22am
   
Have you written any code?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Here is the sample code
 
Data to be embedded in a row is defined in the class 'Data'
public class Data
{
    public string Name { get; set; }
}
 
XAML front end code will be:
<UserControl .... xmlns:my="clr-namespace:System.Windows.Controls; assembly=System.Windows.Controls.Data>...
<my:DataGrid x:Name="dg" AutoGenerateColumns="True"></my:DataGrid>
<TextBox x:Name="Nametxt" />
<Button Content="Add" Click="Btn_click"/>
 
Code behind C# is
List<data> source = new List<data>();
dg.ItemsSource = source;
 
void Btn_Click(...)
{
        source.Add(new Data()
        { 
            Name = Nametxt.Text.Trim();
        });
}</data></data>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You should do a bit of research before posting a question.
See
this,
this,
this,
or just use search option or google it!
 
Learning is a process, shortcuts aren't always best solution.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 9 Mar 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100