Solved

Adding an Input Column to a DataGridView

Posted on 2009-05-09
2
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Suggested Solutions

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…
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.
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…
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…

732 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