Textbox retrieving multiple values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ummaria
    New Member
    • Mar 2007
    • 16

    #1

    Textbox retrieving multiple values

    Hello,

    I need help in VB.NET.
    I'm developing an asset management application.
    assets have different types (Computer), and a label initial for this type (PC).

    When the user wants to add an asset, he/she should select the type name (Computer) from a dropdownlist and the textbox that is under that dropdownlist will show the label initial (PC).

    What I want the program to do is display automatically PC + the number of assets added for that specific type. (PC0001) if it was the 1st computer added and (PC0002) for the 2nd ..etc.

    Note that the asset label initial and the asset number = label number which is the primary key of the asset table.

    I managed to retreive the label initial into the textbox. But how can I add the number of that asset for each asset type? Should there be a property in the database to hold this value?

    Solving this would make things very much easier. I would really appreciate if some one would help :)
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by ummaria
    Hello,

    I need help in VB.NET.
    I'm developing an asset management application.
    assets have different types (Computer), and a label initial for this type (PC).

    When the user wants to add an asset, he/she should select the type name (Computer) from a dropdownlist and the textbox that is under that dropdownlist will show the label initial (PC).

    What I want the program to do is display automatically PC + the number of assets added for that specific type. (PC0001) if it was the 1st computer added and (PC0002) for the 2nd ..etc.

    Note that the asset label initial and the asset number = label number which is the primary key of the asset table.

    I managed to retreive the label initial into the textbox. But how can I add the number of that asset for each asset type? Should there be a property in the database to hold this value?

    Solving this would make things very much easier. I would really appreciate if some one would help :)
    try this code

    Code:
     
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
    System.EventArgs) Handles MyBase.Load
    
       ComboBox1.Items.Add("Nancy Davolio")
       Microsoft.VisualBasic.Compatibility.VB6. _
          SetItemData(ComboBox1, ComboBox1.Items.Count() - 1, 12345)
    
       ComboBox1.Items.Add("Judy Phelps")
       Microsoft.VisualBasic.Compatibility.VB6. _
          SetItemData(ComboBox1, ComboBox1.Items.Count() - 1, 67890)
    End Sub
    
    
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    
       Label1.Text = "Employee #" & CStr( _
       Microsoft.VisualBasic.Compatibility.VB6. _
          GetItemData(ComboBox1, ComboBox1.SelectedIndex))
    End Sub
    try it
    :)

    Comment

    Working...