Solved

Dataset

Posted on 2006-06-16
10
330 Views
Last Modified: 2010-04-23
Using a datagrid to show dataset. I'd like to add a column to my table. I've looked into the code already present, and the only way i've found so far was to play into the Windows Form Designer generated code


Any better idea ? some quick editing tips to add a column. Coze adding it this way can be long.
0
Comment
Question by:TheSonics
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 16920642
Dim dsDataset As New DataSet

dsDataset.Tables(0).Columns.Add("NewColumn")
dsDataset.Tables(0).Columns("NewColumn").DataType = GetType(Integer)
dsDataset.Tables(0).Columns("NewColumn").ColumnName = "MyNewColumn"

0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16920646
just reconfigure data adapter
0
 

Author Comment

by:TheSonics
ID: 16920965
Pretty nice, i want that row to be a checkbox. Increased point :P
0
 

Author Comment

by:TheSonics
ID: 16920969
i meant column, to be checkbox.
0
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 16921953
For a checkbox, you simply need to change the Datatype of the column.  A checkbox can have values of True/False, which is a Boolean, so:

 dsDataset.Tables(0).Columns("NewColumn").DataType = GetType(Boolean)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:TheSonics
ID: 16922985
Here how is it working:

I have a column named "Resp" using :
    Friend WithEvents dsHistoricRespCol As System.Data.DataColumn
and
    Friend WithEvents dgtbHistoricRespColStyle As System.Windows.Forms.DataGridTextBoxColumn

When I do resizing or similaire stuff, i do the modifications on the datagridtextboxcolumn.


So far i have added the column via the .NET interface and it creates a datacolumn. But how do I set a style via the interface ?


        Me.dgtbMeasLimitMaxColStyle.Format = ""
        Me.dgtbMeasLimitMaxColStyle.FormatInfo = Nothing
        Me.dgtbMeasLimitMaxColStyle.HeaderText = resources.GetString("dgtbMeasLimitMaxColStyle.HeaderText")
        Me.dgtbMeasLimitMaxColStyle.MappingName = resources.GetString("dgtbMeasLimitMaxColStyle.MappingName")
        Me.dgtbMeasLimitMaxColStyle.NullText = resources.GetString("dgtbMeasLimitMaxColStyle.NullText")
        Me.dgtbMeasLimitMaxColStyle.Width = CType(resources.GetObject("dgtbMeasLimitMaxColStyle.Width"), Integer)
 

Knowing the defenition of the style column, it is using the resources files, so it gotta be created via some "tools". I dont think its efficient to edit all this stuff manually.
0
 

Author Comment

by:TheSonics
ID: 16934466
any suggestions ?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16935124
Are you looking to display a column using check boxes, using the a column style?

Bob
0
 

Author Comment

by:TheSonics
ID: 16935402
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 16935563
Through the interface, you can define a DataGridBoolColumn by pulling down the drop-down list:

https://filedb.experts-exchange.com/incoming/ee-stuff/222-DataGridColumnStyle-Collection-E.png 

Bob
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change data in datatable 8 31
Red error squiggly on vb.net 7 27
VB.net/WinForms: adjust Screen Resolution 6 44
Pagebreak issue while printing the aspx page 3 16
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 …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

864 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now