.NETGURU
datagrid
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

homer (VIP)
In my vb6 app, there is a flexgrid control, mimicking the excel
spreadsheet UI. Now we are preparing to move it to dot net. What is the
equivalent
of it?
Does the native datagrid have the features?
I looked through the object browser and msdn, but did not find good
reference. Datagrid seems lack of the capability of binding to data
cell by cell.

Reply to this message...
 
    
Cor Ligthert
Homer,

> Datagrid seems lack of the capability of binding to data cell by cell.

Can you explain something more what you mean by that?

Cor

Reply to this message...
 
    
homer (VIP)
I am looking for datagrid properties like TextMatrix in flex grid, or
rows(i).cols(j) collections to iterate with a dataset field data. I did not
find any such properties.
dg.SetDataBinding or dg.datasource/datamember gave me the capability of
binding the whole grid with the a ds. I also checked out the
DataGridTableStyle and other members, but did not find the feature I want.
What made me wonder maybe I am looking at wrong control.

Anyway, thank you for your reply, and here is one of the vb6 pieces I tried
to replace.

For i = 0 To rs.Fields.Count - 1 'this loop is for rows
For j = 1 To rs.RecordCount 'this loop is for Columns
fg.TextMatrix(i, j) = rs(i)
rs.MoveNext
Next
rs.MoveFirst
....

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
Homer,

A datatable can be an object in a dataset that holds collections of rows.

A dataset is when filled a collection of datatables, which has collections
of rows, which has collections of items.

Therefore your sample can be written as (you can compare a recordset with a
datatable not with a dataset what often is thought)

For i as as integer = 0 to dt.count - 1
for y as integer = 0 to dt.rows(i).count - 1
myitem = dt.rows(i).item(y)

However that is not needed because
mydatagrid.datasource = dt is enough

Better is to use the dataview which is a kind of filter so first
dim dv as dataview(dt)
mydatagrid.datasource = dv

A datatable has not direct to be a table from a database or from a dataset
and you can make it by hand.

I hope this helps?

Cor

"homer" <

[Original message clipped]

Reply to this message...
 
    
homer (VIP)
Cor,

Thank you for the clarification on dataset, datatable, and dataview in the
dotnet.

I guess I did not explain myself well. The reason I said
mydatagrid.datasource=dt is not enough is this. The datagrid I need to fill
has to show data in an order different from that of the data table. 1st row
of datatable will shows as 1st column in the datagrid, 2nd row as 2nd column,
etc.

Here is the sample data in the table:
ssn/lastname/firstname
123/Jones/Boby
234/Smith/Doe
..../.../...

Here is how they should look in the grid
ssn/123/234/...
lastname/Jones/Smith/...
firstname/Boby/Doe/...

Also, some of the contents of the grid have to be dynamically generated, but
not from the database.

I have dons of vb6 UI code like this, and that is one of the reason they are
not willing to move to dotnet.

Homer

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
Homer,

I once have made a sample for that however I cannot find it.

I type it in this message what it should look like it, check yourself where
I did it wrong.

\\\
dim dt as new datatable
for i as integer = 0 to dtOld.rows.count -1
dt.colums.add(i.tostring)
next
for i as integer = 0 to dtOld.columns.count - 1
dim dr as datarow = dt.newrow
for y as integer = 0 to dtOld.rows.count - 1
dr(i) = dtOld.rows(y).items(i).tostring
next
dt.rows.add(dr)
next
datagrid.datasource = dt
///
I hope this helps?

Cor

Reply to this message...
 
    
homer (VIP)
Cor,

Thank you so much! I got the idea. Instead of binding the old data table to
data grid, you massage the old data table into a new one according to the
needs, and then bind it to the data grid. Brilliant idea!

Homer

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Windows.Forms.DataGridTableStyle




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification