DataGrid Sorting

  • Thread starter Thread starter Didymus
  • Start date Start date
D

Didymus

Hello Everyone,

I have a DataAdapter with for columns of data.
I want to only display the first two columns of data in the DataSet.

How can I do this?

Thanks,

Gary
 
Better yet,

How do I display only the first two columns from the DataSet?
Or display the first two columns in a RichTextBox?

Gary
 
Gary,
Create a DataGridStyle
and Add the columns from the DataTable to it
something like:

Function CreateGridStyle(ByVal t AS DataTable) AS DataGridStyle
CreateGridStyle = New DataGridStyle
CreateGridStyle.MappingName= t.TableName

With CreateGridStyle
..ReadOnly = False 'Make DataGrid read Only
.. BackColor=Color.AntiqueWhite ' Sets back colour, note Colour is spelt
wrong in VB & Dot Net
'Add other properties
Dim Col1 As New DataGridTextBoxColumn
with Col1
..MappingName= "MyFirstColumn" 'Name of Field you want to display
..Width = 80 'Width of Column
..Alignment= HorizontalAlignmentLeft 'Field Justification
..readOnly = true 'Makes Column read Only
..HeaderText = "Column 1" 'Header for Column 1
..NullText = "" 'Value to use if Data value is Null
'Add other properties if you need them
End With
..GridColumnStyle.Add(Col1) 'Adds Col1 to the Data Grid
End With

End Function
 
Gary,
Better yet,

How do I display only the first two columns from the DataSet?
Or display the first two columns in a RichTextBox?
Can you give us an idea with that, do you want to make a grid and than add
that to the RichText box, I think that you are one of the only ones who
wants that, and than you have to invent it yourself. With such a lot of
controls which do that job better I will not think one minute about it.

Your other question is answered by Doug, I do not think that I can add
something to that add the moment that will help you better.

I hope that this answer helps anyway?

Cor
 
Thanks Doug,

I'll give it a try as soon as I get a chance. I will post a better
description as to what I am trying to do as well.

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top