Click here to Skip to main content
Licence 
First Posted 29 Nov 2004
Views 22,072
Bookmarked 12 times

ResultSetTextBox

By | 31 May 2005 | Article
Displays data contained in a DataSet into a RichEdit control.
 
Part of The SQL Zone sponsored by
See Also

Introduction

Hello pals. This is really a short article so I am gonna go straight to the point. I came with the idea of developing this simple control because I was developing an application where in one form I had to display data contained in a DataSet and didn't want to use a DataGrid for this purpose. After I did it, I thought it was sort of cool so I decided to share it with you. This is a picture of the control during runtime:

Displaying the data is very simple. Here's the snippet of code I use to load the DataSet. Currently, the control displays all DataTables in the DataSet.

private void btnOpen_Click(object sender, System.EventArgs e)
{
   DataSet ds = new DataSet();
   ds.ReadXml("C:\\myFile.xml");
   this.resultSetTextBox1.DataSource = ds;
   this.resultSetTextBox1.DataBind();
}

The only change to this article is that, at first when I posted it, it did not include the source code. So here it is.

The control has several properties as:

  • bool ShowTableNames: which decides whether to include the table names in the result sets.
  • int DefaultColumnWidth: is the width for the columns and DataRow[Column]. If the width of one of the DataRow[Column]'s is wider than DefaultColumnWidth, this DataRow[Column] length is cut to DefaultColumnWidth - 2. This is simply to avoid the overlapping of one DataRow[Column] to the other DataRow[Column].

Well, that's all there's to it. I expect that you like it. All comments are welcome.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Alexander German

Web Developer

Spain Spain

Member

I have been programming for a few years now, like since 1996. Currently working as freelance.
 
C#.NET MCP. Works with tools such as Delphi, C#.NET, VB.NET, ASP.NET, ADO.NET, XML, java, j2me, Oracle, mySQL, and Sql Server, etc, etc. Open to everything.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralSource code PinstaffSmitha Vijayan23:01 23 May '05  
GeneralRe: Source code PinmemberAlexander German3:09 31 May '05  

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

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

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 31 May 2005
Article Copyright 2004 by Alexander German
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid