Hi,

I'm working on a new project and I would like to use VB.Net in Visual Studio 2005. I'll import data in a row/column format.I've been playing around w/ the datagrid control a little and I've gotten my data to import, but I'm not sure if this control has the functionality I need.
One of the columns contains cubic feet. The user needs to be able to take away any number of cubic feet from a row. Cubic feet is related to the trailor that the product will go into because the trailor can only hold "X" cubic feet. When some of the cubic feet are removed other records in that row will be affected and have to change accordingly. The cubic feet that gets removed will be stored somewhere else (an array maybe) along w/ the corresponding values that will be taken away from that same row (i.e. dollars, weight...).

Any insite, advise, or help in general is greatly appreciated.

Thanks,
David

david,
if ur using sql-server 2005(then while creating table ).just set the datatypes value according to ur need.if u want data to b displayed in dollar format(just-set particular column to dollar format)...then search in datatypes avaliable,,,,,
happy coding....

Thanks for replying preetham.

I'm not sure what I'm going to use to store my data yet. Is SQL server something that comes with Visual Studio 2005? I'm really not clear on this.
With the datagrid I need to be able to let the user manipulate the data in each individual cell by subtracting a certain amount from it. The amount that is subtracted will be moved and stored somewhere else and the cell on the datagrid should show what is left. Is this something that can be done with the datagrid?

Thanks,
David

Thanks for replying preetham.

I'm not sure what I'm going to use to store my data yet. Is SQL server something that comes with Visual Studio 2005? I'm really not clear on this.
With the datagrid I need to be able to let the user manipulate the data in each individual cell by subtracting a certain amount from it. The amount that is subtracted will be moved and stored somewhere else and the cell on the datagrid should show what is left. Is this something that can be done with the datagrid?

Thanks,
David

Hello
I think you should be able to do it with Access database. Only part of the code below:

Dim cf1, cf2, cf3, cf4, cfr1, cfr2 As Double
Dim ccf1, ccf2, ccfr1, ccfr2 As DataGridViewCell
Private Sub CalculateCubic1()
If grdClublic.Rows.Count > 0 Then
rowindex = grdCublic.CurrentCell.RowIndex
Dim row As DataGridViewRow = grdCublic.Rows(rowindex)
ccf1 = row.Cells(0)
ccf2 = row.Cells(1)
ccf3 = row.Cells(2)
ccf4 = row.Cells(3)
ccfr1 = row.Cells(4)
ccfr2 = row.Cells(5)
crecno = row.Cells(6)

cf1 = CDbl(ccf1.Value)
cf2 = CDbl(ccf2.Value)
cf3 = CDbl(ccf3.Value)
cf4 = CDbl(ccf4.Value)
cfr1 = CDbl(ccfr1.Value)
cfr2 = CDbl(ccfr2.Value)
end sub
private sub CalcCubic2()
call CalcCubic1()
cfr1 =cf2 - cf1
cfr2=cf4-cf3
end sub
Then update your database and refill your grid. Every time a value is changed the database would need to be updated and the cfr1 and cfr2 (representing the remaining cubic feet) would stay current.
I hope this helps
Scott

Do you need to edit the stored values? Or could you use a calculated field in your datatable? i.e.

mtblDocs.Columns.Add("Overflow", GetType(Double))
' Capacity is trailer capacity
' CubicM is the number of Cubic metres required
mtblDocs.Columns("Overflow").Expression = "CubicM-Capacity"

Thanks for the replies and code!

Ranx,
I'm still in the beginning stages of this program, so I'm not completely sure how its going to work yet.
Data will be brought in from a mainframe on a daily basis. The logic will have to work through the data from the mainframe. Based on several criteria, the logic will pick which orders to send to a truck to be shipped. There will be 4 different trucks at any given time that hold different types of orders, so there will be much going on. Some orders will be completely sent to a truck, but some will be partially sent which will leave some of that order to be shipped the next day.
The orders that have been selected to ship will be sent back into the mainframe and when the data comes back the next day it will show what wasn't selected from the previous day as well as new orders.

So, to answer your question, hopefully, once the data has been gone through it won't necessarily have to be stored. The orders that have been assigned to a trailor will need to be printed out in some sort of a report. And if a trailor was only partially filled it will have to be stored in the database to be filled later. The data on the datagrid will need to be updated as the orders are selected, so that the user will know how much is left.

I hope that answers your questions. But let me know if it doesn't and I'll try to explain better.

Thanks,
Dave

I think the datagrid (or datagridview) will handle the display of the data adequately, but i've never been a fan of editing directly from a grid. I prefer a separate form or set of controls to do the editing so we can see the records related data all in one place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.