• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

Updatable DataGridView

Hi,

I need to create a VB Windows form that contains an updatable datagridview. The tables I have look like this:

Table: Report_Table
Primary_Key: Report_ID (GUID)
Columns: Report_Type (FK), Report_Name, Report_Description, Run_Flag(bit)

Table: Rerport_Type_Table
Primary_Key: Report_Type
Columns: Report_Type_Description

Basically, on the datagridview, I want the user to be able to update the record, but I want to show the Report_Type as a drop down, and the Run_Flag as a checkbox.  On top of the datagridview, there is a save button, that when clicked, will save all the changes to the database in batch.

How do I do this?  I am using Visual Basic 2005 and  SQL Server 2005.

Thanks.
0
crickpaolo
Asked:
crickpaolo
  • 3
  • 3
1 Solution
 
Bob LearnedCommented:
Does this mean that you are looking for a hierarchical parent-child display?

Bob
0
 
crickpaoloAuthor Commented:
Hi Bob,

I'm not sure. But I only need to show one DataGridView. The DataGridView displays the rows from the Report_Table.  However, instead of displaying just plain text on each column, I wan't to show the Run_Flag as a checkbox, and Report_Type as a combobox that lookup data from the Report_Type_Table.

I am looking for how to manually format the columns on the DataGridView.
0
 
JR2003Commented:
You can do it with
<asp:TemplateField >
and
<ItemTemplate>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
crickpaoloAuthor Commented:
Thanks JR2003. But I am building a VB 2005 Windows Form, not ASP.NET.
0
 
Bob LearnedCommented:
There are the DataGridViewCheckBoxColumn and DataGridViewComboBoxColumn types.

Bob
0
 
crickpaoloAuthor Commented:
Thanks Bob. Do you have any sample code that uses them?  I hope you don't mind, I am a newbie at VB 2005...
0
 
Bob LearnedCommented:
All you need to do is:

1) Right-click on the DataGridView, and select Add Column

2) DataGridViewCheckBoxColumn, DataPropertyName

3) DataGridViewComboBoxColumn, DataPropertyName, Items

4) Set the DataSource for the DataGridView

5) In code, set DataGridView.AutoGenerateColumns = False.

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now