[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to create multiple fixed rows with DataGrid?

Posted on 2004-09-01
13
Medium Priority
?
341 Views
Last Modified: 2012-08-13
Hey all,

I remember in old VB 6 that with the Flexgrid control (I think), you could specify how many fixed header rows you wanted up the top.

Unfortunately now that I am using the .NET datagrid I can no longer work out how to do this.  Does anyone have any ideas?

Thanks!

Dwayne

0
Comment
Question by:Visual_Pro
[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
  • 7
  • 4
13 Comments
 
LVL 10

Accepted Solution

by:
prakash_prk earned 500 total points
ID: 11951608
Datagrid is a bounded control you must bound it to a datasource (Dataviewm, dataset,Datatable)
The bounded table contents are displayed in the datagrid

use the flexGrid Control .

Try this for datagrid
---------
 Private Sub AddRows(ByVal rows As Integer, ByRef Datagrd As DataGrid)
        Dim dview As New DataView
        Dim dtable As New DataTable("firstTable")

        dtable.Columns.Add("First")
        dtable.Columns.Add("Second")
        dtable.Columns.Add("Third")

        dview.Table = dtable
        Dim i As Integer
        For i = 0 To rows - 1
            dview.AddNew()
        Next
        Datagrd.DataSource = dview

    End Sub

prakash
0
 

Author Comment

by:Visual_Pro
ID: 11978908
Hey,

Thanks for that but it wasn't quite what I was after.

That only gives me one header row (where the first, second, third, etc. was)

What I want is to have 2 header rows (like you could do with the old flexgrid control from Visual Basic 6).  But from what I could see there is no Flexgrid control in VB .NET only the datagrid control so I was wondering how to have 2 header rows by using this?

Cheers!

Dwayne
0
 
LVL 10

Expert Comment

by:prakash_prk
ID: 11979657


Ms Flexgrid control is available for .net

right click the toolbox .select  Add/Remove Items . select Com components .

You can see Micosoft flexgrid control

regards
prakash

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Visual_Pro
ID: 12037511
Hey,

I have been trying out the flexgrid control recently but after a lot of failed tests and having done some more research I cannot get it to work.

The only problem is that the flexgrid control doesn't work with my XML dataset so I really need to use the VB .NET Datagrid control.

So do you know how to add 2 fixed header rows with this???

Cheers!

Dwayne
0
 

Author Comment

by:Visual_Pro
ID: 12110665
Please I really need help with this and am even offering a lot more points for it so if you can please help me I would really appreciate it.

Thanks :)
0
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12120047

What to you really need  with datagrid?.
Can you explain your

you can create a table from the XMLDataset accroding to your need(2 fields and rows..)

then assign this table to the datagrid's datasource property

regrads
prakash
0
 

Author Comment

by:Visual_Pro
ID: 12120062
Well the flexgrid control has a property called FixedRows where I can make more then 1 row as a fixed header.

But the datagrid control doesn't have this option.  So I tried your suggestion of using that flexgrid control but it doesn't work with my ado .net data

Which means that I can't use that but have to use the .net datagrid control instead.  However with that I cannot find any fixedrows property and am wondering how else I could make 2 or more fixed rows with it?

Thanks!

Dwayne
0
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12120108

Hi Visual_Pro

                     The datagrid control is a bounded control . it displays the  datasets or  datatable's we can't add a a fixed row or column . for that purposes microsoft gives the flexgrid control .
You can try this .
Read the rows from dataset individully and add it to flexgrid contol.

regards
 prakash
0
 

Author Comment

by:Visual_Pro
ID: 12120119
Oh I see.  That makes sense now.

Well if you wouldn't mind could you please give me a quick example of how to do that then?
0
 

Author Comment

by:Visual_Pro
ID: 12336782
Hello TheLearnedOne,

I am still active with this question.

I was just hoping someone might have been able to provide a code example for the solution that prakash suggested since I am not sure how to code that myself.

I was going to start a new question for it but then decided that since I need code for the solution to work someone else might as well so I was hoping someone would be kind enough to provide some code to illustrate what he was saying and then I can close it.

Cheers!

Dwayne
0
 

Author Comment

by:Visual_Pro
ID: 12599984
Well doesn't look like there is going to be any examples being posted here so to stop this going old I will accept it.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 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