Simulate merging cells in a DataGridView in VB.NET

Posted on 2012-09-13
Last Modified: 2012-09-14

I am aware that in VisualStudio.NET the DataGridView control does not offer mergeing cells.  I do however know that there is a way to simulate this.

In the case where I have a dataset that is empty I want to place a message in the DataGridView indicating "No records in Table.".  I'd like to see if I can put the text in, but would I use some sort of Heading line that I would insert?  I think they call then Bands...

Would a Band work as opposed to using code to Pait across columns?  If so what would the code look like for inserting a Band?  Thanks!
Question by:Peter Allen
    LVL 83

    Accepted Solution


    Author Closing Comment

    by:Peter Allen
    Thank you!  This is exactly what I need.  I will purchase VIBlend soon, but not now.  I am just developing the project.  I only need to use this code to show a message.  The DataGridView will be locked otherwise.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now