Solved

Adding an Input Column to a DataGridView

Posted on 2009-05-09
2
345 Views
Last Modified: 2013-12-03
Hello,

I am developing a VB.NET forms application and I am trying to figure out the best way to approach a particular situation.  I have a form that will contain a DataGridView that will display a list of products which I would like to take inventory for.  I basically want to have a textbox at the end of the DGV that users will enter the amount of each product that they have in stock.  When they click a submit button at the bottom of the form, the program will go through and make an entry in my Inventory table for each product based on the values in the textbox.  What is the best way I should handle this?  Can I have just a blank textbox column where I can associate the value with the product that is on the same row?  Would I have to do some finageling with my Datasets in order to add a column I could store values in?  

TIA,

Mike
0
Comment
Question by:MClarkCCR
2 Comments
 
LVL 12

Accepted Solution

by:
needo_jee earned 500 total points
ID: 24346923
hi

if my understanding is not wrong then perhaps you want to add a column at the end of existing ones, this column will be used to collected input instead showing/displaying existing values? right? if so, I would use this way.

dim dt as dataTable
'fill data table

dt.columns.add("InputColumn")

myGridView.DataSource=dt.

Now it will display last column with empty text fields..


when use press save button.

you may get the newly entered values by iterating datatable rows

for each tr as DataRow in dt.Rows

dim inputValueForFirstRow as string=dr.Item("<last column>")
Next

-Thanks
0
 
LVL 3

Author Comment

by:MClarkCCR
ID: 24358126
needo_jee,

Thanks for your response.  This looks like it'll will probably be just what I needed.  I won't be able to test it out until later this evening, I will update you when I get the chance.

Mike
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

896 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

17 Experts available now in Live!

Get 1:1 Help Now