?
Solved

Dynamic table

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

719 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