iFocus.Life News News - Breaking News & Top Stories - Latest World, US & Local News,Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The iFocus.Life,

How to Change the DataGridView Cell Backcolor

104 22
    • 1). Open Visual Studio 2010 by clicking on its program icon. When it loads, click "File," "New," then "Project" and then click "Visual C#/Windows Forms Application." A new Windows Form Application project will be created and a blank Windows Form will appear in the main editor window.

    • 2). Click and drag the "DataGridView" from the "Toolbox" panel over to the Windows Form. Release the mouse button to place the table on the form.

    • 3). Click the tiny black arrow located in the upper-right corner of the "DataGridView." A menu will appear. Click "Add Column" and click the "OK" button when the "Add Column" dialog box appears.

    • 4). Click the "Cancel" button in the "Add Column" dialog box to close it. Your "DataGridView" should now have one column.

    • 5). Click "View," which is a menu item located on the top row of buttons on the Visual Studio window. A menu will appear. Click "Code" to switch from the graphical editor to a source code editor. A source code file will appear.

    • 6). Locate the following text in the source code file: InitializeComponent();

    • 7). Write the following statement immediately after the "InitializeComponent();" line to set the cell background color to black: dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Black;

    • 8). Click the green "Play" button located in the top row of buttons in the Visual Studio window. A Windows Form will appear and displays a single "DataGridView" with one column and one row. The cell at the intersection between the row and column will have a black background color.

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time
You might also like on "Health & Medical"

Leave A Reply

Your email address will not be published.