Solved

Dynamic table

Posted on 2004-09-29
6
176 Views
Last Modified: 2010-04-23
I have the following requirement:
Step 1: User clicks a "button" to launch a form that asks the number of rows & columns s/he wants. S/he enters the number of rows & columns and hits "Next"
Step 2: In the next window a table with the number of rows & columns appears. User enters some value and submits it to a SQL Server database
------
Step 3: These values of the rows & columns are later retrieved from the database and displayed as a table in a browser using XML & XSLT
------

Question: I am familiar with Step 3, but not sure how to proceed with developing the dynamic table wizard. I presume we must use Datagrid. Any inputs will make my day :)

Regards,
Naren
0
Comment
Question by:narenonline2k
[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
  • 2
6 Comments
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 12187589
ASP.NET or Windows Form???
0
 

Author Comment

by:narenonline2k
ID: 12228223
It is for Windows Form
0
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 250 total points
ID: 12234223
You surely have to use DataGrid....
Say the user enters R rows C Cols then on NEXT Click:

Dim DT As DataTable=New DataTable()
Dim i as Integer

'Create the Columns for the Table
For i=0 to C-1
DT.Columns.Add("Col" & Cstr(i), Type.GetType("System.String"))
Next

'Now this is assuming all Cols are String in case there are different dataTypes you'll have to devise a mechanism, may be the user will provide the dataTypes too

Then

DataGrid1.DataSource = DT

'This will show a Grid with appropriate number of Cols. Now as for the Rows it will only show One Row when the user clicks on it he goes into Edit mode and automatically a new row will also append. If this is OK then that is it otherwise you need to Add dummy Rows to the dataTable may be you can add blank Rows like.

Dim Dr As DataRow
Dr = DT.NewRow
Dr(0)=""
DT.Rows.Add(Dr)

You can put this also in a loop till the No of rows R




0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Groupbox Control ? 2 39
Telerik RadEditor Control Save 8 39
Variable 'id' is used before it has been assigned a value 29 45
Subtract dates in vb.net 6 34
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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