Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dynamic table

Posted on 2004-09-29
6
Medium Priority
?
179 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
  • 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 1000 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

Technology Partners: 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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

926 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