Results 1 to 3 of 3

Thread: I have problem in my datagrid viewer

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Answers
    1

    I have problem in my datagrid viewer

    I have datagridviewer in C# (platform) and i try that change cell beckground, this cell Should be for example 5 (integer!) if in my datagridwiewer Will be 5(whatwhich should be take in my base_database_) its back color will be for example blue.. please help me.

    Sorry for My English. (I am a little).


  2. #2
    Contributing Member
    Join Date
    Jun 2007
    Answers
    65

    Re: I have problem in my datagrid viewer

    Hi Smith,

    It would be easier to answer if you will be specific about which platform you are working upon. Windows (WinForm or WPF) or Web


    ---V V---
    Vikas Vaidya


  3. #3
    Junior Member
    Join Date
    Nov 2009
    Answers
    2

    Re: I have problem in my datagrid viewer

    Here is the sample code for Windows form datagridview; If the cell value is equal or more then the cell color will be green else yello;


    private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
    {
    dataGridView1.EndEdit();
    if (Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) >= 5)
    {
    dataGridView1.Rows[e.RowIndex].Cells[ e.ColumnIndex].Style.BackColor = Color.Green;
    }
    else
    {
    dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Yellow;
    }
    }


  4.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact