?
Solved

Adding a table (<table>) to a windows application

Posted on 2004-08-12
5
Medium Priority
?
231 Views
Last Modified: 2010-04-15
I'm writing a program that's sort of like an event tracker.  I want a form to open that lists the days of the month, and inside the square for each day, what happens on that day.  I figure a table is the best way to do this, but html tags don't work.  At least I can't get them to work inside anything (panels, labels, etc), and there's no table in the toolbox for a windows application.
Anyone have a suggestion of how I can get a table to work?
0
Comment
Question by:TGrimace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Assisted Solution

by:chmohan
chmohan earned 200 total points
ID: 11786821
did you try a  datagrid?on a winform?
0
 
LVL 1

Author Comment

by:TGrimace
ID: 11786926
I played with the datagrid a bit, but couldn't get it the way I wanted it.
0
 
LVL 1

Expert Comment

by:chmohan
ID: 11787068
what was the problem there? when u have the datagrid up,was placing the events that happen that day the problem?because  that is the easiest way to do this:)
0
 
LVL 10

Assisted Solution

by:ptmcomp
ptmcomp earned 200 total points
ID: 11796594
Either use a dataGrid (there are others around than the poor one delivered with the framework) or use the Internet Explorer ActiveX Control to display HTML, if this is really what you want to do.
0
 
LVL 3

Accepted Solution

by:
bigjim2000 earned 600 total points
ID: 11818494
DataGrid's are DEFINITELY the way to go.  Much easier than trying to format a table and import it via an ActiveX control to your form.... ick ;-)

Here's a quick event demo for you I wrote:

private System.Windows.Forms.DataGrid dg;

public struct EVENT
{
      public int EventID;
      public string FriendlyMessage;
      public string Message;
}

private void button1_Click(object sender, System.EventArgs e)
{
      //Populate an array of some test data
      EVENT[] events = new EVENT[2];
      events[0].EventID = 5;
      events[0].FriendlyMessage = "event 5";
      events[0].Message = "this is an event ... yeah";
      events[1].EventID = 7;
      events[1].FriendlyMessage = "event 7";
      events[1].Message = "umm... another event";
      
      PopulateGrid(dg, events);
}

public void PopulateGrid(System.Windows.Forms.DataGrid grid, EVENT[] events)
{
      System.Data.DataTable dt = new System.Data.DataTable();
      System.Data.DataColumn colEventID = new System.Data.DataColumn("EventID");
      System.Data.DataColumn colFMessage = new System.Data.DataColumn("Friendly Message");
      System.Data.DataColumn colMessage = new System.Data.DataColumn("Message");
      dt.Columns.Add(colEventID);
      dt.Columns.Add(colFMessage);
      dt.Columns.Add(colMessage);
      System.Data.DataRow curRow;
      for(int i = 0; i < events.Length; i++)
      {
            curRow = dt.NewRow();
            curRow[colEventID] = events[i].EventID.ToString();
            curRow[colFMessage] = events[i].FriendlyMessage;
            curRow[colMessage] = events[i].Message;
            dt.Rows.Add(curRow);
      }
      grid.DataSource = dt;
}

Hope that helps.

-Eric
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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