Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Updatable DataGridView

Posted on 2007-07-30
7
Medium Priority
?
288 Views
Last Modified: 2013-12-25
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
Comment
Question by:crickpaolo
  • 3
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19594041
Does this mean that you are looking for a hierarchical parent-child display?

Bob
0
 

Author Comment

by:crickpaolo
ID: 19594106
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
 
LVL 18

Expert Comment

by:JR2003
ID: 19594411
You can do it with
<asp:TemplateField >
and
<ItemTemplate>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:crickpaolo
ID: 19594430
Thanks JR2003. But I am building a VB 2005 Windows Form, not ASP.NET.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 19594814
There are the DataGridViewCheckBoxColumn and DataGridViewComboBoxColumn types.

Bob
0
 

Author Comment

by:crickpaolo
ID: 19594866
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 19597277
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

581 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