Solved

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

Posted on 2004-08-12
5
228 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 50 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 50 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 150 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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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