Solved

Adding an Input Column to a DataGridView

Posted on 2009-05-09
2
346 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio 2015 Source Code Control 10 52
Zip Folders Using Chilkat Routines 1 36
How do you do a one to many list in .NET CORE? 2 24
start a process from a service 3 21
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

786 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