Displaying/Manipulating Simple 2-D Table

F

fripper

I am at my wits end trying to do a very simple task in VB .Net. I have
spent a number of hours trying to figure out how to use datasets, datatables
and the Datagrid control but I am lost in the mass of functionality and
details that these entail. My task is simple ... I simply want to display a
bunch of data (not from an SQL darabase) in tabular form ... I want to be
able to set the width of each column and the foreground/background colors of
individual cells. I also want to be able to know what cell (row number and
column number) the user has clicked. Now I used to use the old Flexgrid
control in VB6 ... it was GREAT .. simple, intuitive and uncomplicated.
Isn't there some way in VB .Net to do the same thing without getting all
tied up in knots with the blockbuster dataset/datatable/datagrid complex?

Thanks.
 
C

Cor Ligthert [MVP]

Fripper,

If you only want to use it as a flexgrid, than create datatables.

I thought that I had showed you a link to our website, that is full of it.

However the most simple one drag a datagrid on a new form and type paste
this in the load event. I typed it here so watch typos

\\\
dim dt as new datatable()
dt.columns.add("name")
dt.columns.add("email")
dt.loaddatarow(new object() {"fripper", "(e-mail address removed)"},true)
mydatagrid.datasource = dt
///

Try it and don't tell anymore than that it is more difficult than a
flexgrid.

In addition if you want to see more see our website it started ad a datagrid
website.

http://www.vb-tips.com/default.aspx

I hope this helps,

Cor
 
F

fripper

OK ... that's a start ... but I still cannot figure out how to do the
simplest things ... can I force the width of the "name" column to some
number of pixels? ... How do I set the background color of the item in the
second row and second column to, say, "light blue"? ... when a user clicks a
cell how do I know what row/column was clicked and how can I force the value
in that cell to be, say, 5? I cannot find an example anywhere that talks
about these simple manipulations.

Your web site is a great resource ... it's just that I don't see there
examples which apply to my situation.

Thanks for your patience.
 
C

Cor Ligthert [MVP]

Fripper,

We have tried to place the most often asked questions on our Website which
are a little bit to complex to tell in a message.

In those are mostly not the basic things which are direct in the information
on MSDN about a datagrid.

http://msdn.microsoft.com/library/d...ndowsformsdatagridtextboxcolumnclasstopic.asp

However I advice you to start with the simple things, I assume that you did
the same with the flexgrid the first time.

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top