Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Thanks for prior help- next problem- array/collection or class to store/save data

Thanks for prior help- next problem- array/collection or class to store/save data

Scheduled Pinned Locked Moved Visual Basic
helpagentic-aidata-structuresquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lemarshall
    wrote on last edited by
    #1

    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?

    A 1 Reply Last reply
    0
    • L lemarshall

      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?

      A Offline
      A Offline
      Andy_L_J
      wrote on last edited by
      #2

      Maybe not a bad idea,

      Public Class Material

      Private _id As String
      Private _name As String
      Private _value As Double

      Public Property ID() As String
      Get
      Return _id
      End Get
      Set(ByVal value As String)
      _id = value
      End Set
      End Property

      Public Property Name() As String
      Get
      Return _id
      End Get
      Set(ByVal value As String)
      _id = value
      End Set
      End Property

      Public Property ID() As String
      Get
      Return _id
      End Get
      Set(ByVal value As String)
      _id = value
      End Set
      End Property

      Public 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 Sub

      End 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 the MatList 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

      L 1 Reply Last reply
      0
      • A Andy_L_J

        Maybe not a bad idea,

        Public Class Material

        Private _id As String
        Private _name As String
        Private _value As Double

        Public Property ID() As String
        Get
        Return _id
        End Get
        Set(ByVal value As String)
        _id = value
        End Set
        End Property

        Public Property Name() As String
        Get
        Return _id
        End Get
        Set(ByVal value As String)
        _id = value
        End Set
        End Property

        Public Property ID() As String
        Get
        Return _id
        End Get
        Set(ByVal value As String)
        _id = value
        End Set
        End Property

        Public 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 Sub

        End 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 the MatList 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

        L Offline
        L Offline
        lemarshall
        wrote on last edited by
        #3

        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"

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups