Click here to Skip to main content
15,892,199 members
Home / Discussions / C#
   

C#

 
Questiondatagrideview Pin
sevda207-Mar-09 19:21
sevda207-Mar-09 19:21 
AnswerRe: datagrideview Pin
vinodkrebc7-Mar-09 21:42
vinodkrebc7-Mar-09 21:42 
QuestionRemoting in .NET 2.0 - still not getting it! Pin
caix7-Mar-09 16:30
caix7-Mar-09 16:30 
AnswerRe: Remoting in .NET 2.0 - still not getting it! Pin
aviadqwerty8-Mar-09 5:44
aviadqwerty8-Mar-09 5:44 
QuestionChange fore color of datetimepicker Pin
trinm19877-Mar-09 16:09
trinm19877-Mar-09 16:09 
AnswerRe: Change fore color of datetimepicker Pin
DaveyM698-Mar-09 0:53
professionalDaveyM698-Mar-09 0:53 
AnswerForeColor and BackColor Pin
DaveyM698-Mar-09 2:20
professionalDaveyM698-Mar-09 2:20 
Questionproblem with datagrid Pin
Shuaib wasif khan7-Mar-09 10:16
Shuaib wasif khan7-Mar-09 10:16 
hello sir/mam
i have a problem plz solve me out this problem.
i am working on a window application in c# .i have a datagrid which contain a DataGridBoolColumn and datagridtextboxcolumn.i am using table name as stock which contains feild subject,bookname,rate,sellrate,quantity.lbltotal is the label which shows the the total of sellrate.now my problem is that i have to show only those total which are checked
means if any one unchecked the check box the sellrate must be deducted in the from the total.
and i have to insert all the rows of the datagrid in the table except those which are uncheked.plz help me . thanks in advance Sigh | :sigh:



try
{
SqlConnection cn=new SqlConnection(Class1.connect());
SqlDataAdapter cmd=new SqlDataAdapter("select subject , bookname,rate,sellrate ,quantity from stock where class ='"+txtclass.Text+"'",cn);
// DataSet dt=new DataSet();

DataTable dt=new DataTable("stock");
cmd.Fill(dt);
dataGrid1.DataSource=dt;
this.dataGrid1.TableStyles.Clear();
DataGridTableStyle tb=new DataGridTableStyle();
tb.MappingName="stock";
DataGridBoolColumn td=new DataGridBoolColumn();
td.MappingName="rate";
td.HeaderText="";
td.AllowNull=true;
td.Width=20;
tb.GridColumnStyles.Add(td);
DataGridTextBoxColumn txt=new DataGridTextBoxColumn();
txt.MappingName="Subject";
txt.HeaderText="Subjects";
txt.Width=160;txt.ReadOnly=true;
tb.GridColumnStyles.Add(txt);
txt=new DataGridTextBoxColumn();
txt.MappingName="bookname";
txt.HeaderText="Book Name";
txt.Width=200;
txt.ReadOnly=true;
tb.GridColumnStyles.Add(txt);
txt=new DataGridTextBoxColumn();
txt.MappingName="sellrate";
txt.HeaderText="Rate";
txt.Width=160;
txt.ReadOnly=true;
tb.GridColumnStyles.Add(txt);
dataGrid1.TableStyles.Add(tb);

// SqlConnection cn=new SqlConnection(Class1.connect());
SqlCommand cd=new SqlCommand("select sum(sellrate) from stock where class='"+txtclass.Text+"'",cn);
cn.Open();
SqlDataReader dr=cd.ExecuteReader();
if(dr.Read())
{
lbltotal.Text="Total = "+dr[0].ToString();
}
else
{
lbltotal.Text="Total = 0 0";
}
cn.Close();



}
catch(Exception ex)
{
MessageBox.Show(ex.Message,Class1.name());
lbltotal.Text="Total = 0 0";
}
AnswerRe: problem with datagrid Pin
Xmen Real 7-Mar-09 14:24
professional Xmen Real 7-Mar-09 14:24 
AnswerRe: problem with datagrid Pin
sohighthesky8-Mar-09 4:57
sohighthesky8-Mar-09 4:57 
Questionbluetooth functionality using franson bluetools (Pocket PC) [modified] Pin
Yanal_Adham7-Mar-09 8:58
Yanal_Adham7-Mar-09 8:58 
AnswerRe: bluetooth functionality using franson bluetools (Pocket PC) Pin
DaveyM697-Mar-09 10:22
professionalDaveyM697-Mar-09 10:22 
QuestionArray Sort Pin
mehdy_1377-Mar-09 8:43
mehdy_1377-Mar-09 8:43 
AnswerRe: Array Sort Pin
fly9047-Mar-09 8:57
fly9047-Mar-09 8:57 
AnswerRe: Array Sort [modified] Pin
harold aptroot7-Mar-09 8:59
harold aptroot7-Mar-09 8:59 
QuestionClick images with webcam using c# Pin
Umangj7-Mar-09 8:26
Umangj7-Mar-09 8:26 
AnswerRe: Click images with webcam using c# Pin
DaveyM697-Mar-09 10:26
professionalDaveyM697-Mar-09 10:26 
GeneralRe: Click images with webcam using c# Pin
Umangj7-Mar-09 10:29
Umangj7-Mar-09 10:29 
GeneralRe: Click images with webcam using c# Pin
DaveyM697-Mar-09 11:20
professionalDaveyM697-Mar-09 11:20 
AnswerRe: Click images with webcam using c# Pin
Eddy Vluggen8-Mar-09 2:35
professionalEddy Vluggen8-Mar-09 2:35 
QuestionVista or .NET remember? Access to System32 Pin
NorbertKl177-Mar-09 6:48
NorbertKl177-Mar-09 6:48 
AnswerRe: Vista or .NET remember? Access to System32 Pin
harold aptroot7-Mar-09 7:22
harold aptroot7-Mar-09 7:22 
GeneralRe: Vista or .NET remember? Access to System32 Pin
NorbertKl177-Mar-09 8:31
NorbertKl177-Mar-09 8:31 
GeneralRe: Vista or .NET remember? Access to System32 Pin
harold aptroot7-Mar-09 8:53
harold aptroot7-Mar-09 8:53 
GeneralRe: Vista or .NET remember? Access to System32 Pin
NorbertKl177-Mar-09 9:22
NorbertKl177-Mar-09 9:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.