Thanks for prior help- next problem- array/collection or class to store/save data
-
Ok, I have the labels working properly on each tab. I can change them based upon the sequence of orders for each item placed the day before. (I am manually adjusting that now). I need to create the Function MaterialSave(). Each item on each tab has 5 textboxes for New (A), Good (B1), Good (B2), Good (C) or Junk (F). First textbox is txtRodF_0, txtRodC_0, txtRodB2_0 and next row is txtRodF_1, txtRodC_1, txtRodB2_1, etc. I need to store the materialID (a GUID) that is stored in the lblRods_x.Tag property, the name of the text box txtRodC_0.name and the number of units being traded. A person can trade/sell 15 units of txtRodF_0 and 20 units of txtRodB2_0 and any combination od trades/sells per tab per Material Transfer form. Each agent can do 100 or so forms per day. I tried doing a multi-dimensional array and then a collection and have bombed out on each of them. Then I was researching and came across maybe using a Material Class with 3 properties and I just add class member everytime a textbox loses focus after an amount has been entered. I can then save the class members one by one to the material table on the form_close event. When a new form is pulled up it creates a new material class all over. Any ideas or suggestions, better/faster way of doing this?
-
Ok, I have the labels working properly on each tab. I can change them based upon the sequence of orders for each item placed the day before. (I am manually adjusting that now). I need to create the Function MaterialSave(). Each item on each tab has 5 textboxes for New (A), Good (B1), Good (B2), Good (C) or Junk (F). First textbox is txtRodF_0, txtRodC_0, txtRodB2_0 and next row is txtRodF_1, txtRodC_1, txtRodB2_1, etc. I need to store the materialID (a GUID) that is stored in the lblRods_x.Tag property, the name of the text box txtRodC_0.name and the number of units being traded. A person can trade/sell 15 units of txtRodF_0 and 20 units of txtRodB2_0 and any combination od trades/sells per tab per Material Transfer form. Each agent can do 100 or so forms per day. I tried doing a multi-dimensional array and then a collection and have bombed out on each of them. Then I was researching and came across maybe using a Material Class with 3 properties and I just add class member everytime a textbox loses focus after an amount has been entered. I can then save the class members one by one to the material table on the form_close event. When a new form is pulled up it creates a new material class all over. Any ideas or suggestions, better/faster way of doing this?
Maybe not a bad idea,
Public Class Material
Private _id As String
Private _name As String
Private _value As DoublePublic Property ID() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End PropertyPublic Property Name() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End PropertyPublic Property ID() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End PropertyPublic Sub New(ByVal id As String, ByVal name As String, _
ByVal value As Double)
With Me
ID = id
Name = name
Value = value
End With
End SubEnd Class
Now if you use your Material Class in a Generic List that you declare as a Form Level variable
Public MatList As List(Of Material)
, you will be able to retreive, and add items to your hearts content. Then when the form closes, save your data, iterating through the items in theMatList
Hope this helps.I don't speak Idiot - please talk slowly and clearly 'This space for rent' Driven to the arms of Heineken by the wife
-
Maybe not a bad idea,
Public Class Material
Private _id As String
Private _name As String
Private _value As DoublePublic Property ID() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End PropertyPublic Property Name() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End PropertyPublic Property ID() As String
Get
Return _id
End Get
Set(ByVal value As String)
_id = value
End Set
End PropertyPublic Sub New(ByVal id As String, ByVal name As String, _
ByVal value As Double)
With Me
ID = id
Name = name
Value = value
End With
End SubEnd Class
Now if you use your Material Class in a Generic List that you declare as a Form Level variable
Public MatList As List(Of Material)
, you will be able to retreive, and add items to your hearts content. Then when the form closes, save your data, iterating through the items in theMatList
Hope this helps.I don't speak Idiot - please talk slowly and clearly 'This space for rent' Driven to the arms of Heineken by the wife
Thanks, I seem to have that part working now. got another problwm which I don't seem to remember that in VB6. Started another post for it titled: "Lost_focus and save button"