[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Adding an Input Column to a DataGridView

Posted on 2009-05-09
2
Medium Priority
?
352 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:
Munawar Hussain earned 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 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 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…
Suggested Courses

649 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