Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 3 - Using Data Sources with the DataGridView C...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Using Data Sources with the DataGridView Control
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2006-11-09

    Table of Contents:
  • Using Data Sources with the DataGridView Control
  • How to generate a DataGridView control from a data source
  • How to edit the properties of a DataGridView control
  • How to edit the columns of a DataGridView control
  • A Product Maintenance application that uses a DataGridView control

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Data Sources with the DataGridView Control - How to edit the properties of a DataGridView control


    (Page 3 of 5 )

    When you generate a DataGridView control from a data source, Visual Studio usually sets the properties of this control and the other objects it creates the way you want them. However, if you want to modify any of these properties, you can do that just as you would for any other type of object. In particular, you’ll probably want to edit the properties of the DataGridView control to change its appearance and function.

    To change the most common properties of a DataGridView control, you can use its smart tag menu as shown in figure 14-7. From this menu, you can create a read-only data grid by removing the check marks from the Enable Adding, Enable Editing, and Enable Deleting check boxes. Or, you can let a user reorder the columns by checking the Enable Column Reordering check box.

    In addition to editing the properties for the grid, you may want to edit the properties for the columns of the grid. For example, you may want to apply currency formatting to a column, or you may want to change the column headings. To do that, you can select the Edit Columns command to display the Edit Columns dialog box shown in the next figure.

    When you run an application that uses a DataGridView control, you can sort the rows in a column by clicking in the header at the top of the column. The first time you do this, the rows are sorted in ascending sequence by the values in the column; the next time, in descending sequence. Similarly, you can drag the column separators to change the widths of the columns. Last, if the Enable Column Reordering option is checked, you can reorder the columns by dragging them. These features let the user customize the presentation of the data.

    The smart tag menu for a DataGridView control

    Description

    1. You can use the smart tag menu of a DataGridView control to edit its most commonly used properties.
    2. To edit the columns, select the Edit Columns command to display the Edit Columns dialog box. Then, you can edit the columns as described in the next figure.
    3. To prevent a user from adding, updating, or deleting data that’s displayed in the DataGridView control, uncheck the Enable Adding, Enable Editing, or Enable Deleting check boxes.
    4. To allow a user to reorder the columns in a DataGridView control by dragging them, check the Enable Column Reordering check box.
    5. You can edit other properties of a DataGridView control by using the Properties window for the control.

    Figure 14-7.   How to edit the properties of a DataGridView control

    More Visual Basic.NET Articles
    More By Murach Publishing


       · This article is an excerpt from the book "Murach's Visual Basic 2005," published by...
     

    Buy this book now. This article is excerpted from chapter 14 of the book Murach's Visual Basic 2005, written by Anne Boehm (Murach, 2006; ISBN: 1890774383). Check it out today at your favorite bookstore. Buy this book now.

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek