Connecting Tech Pros Worldwide Help | Site Map

Textbox retrieving multiple values

Newbie
 
Join Date: Mar 2007
Posts: 16
#1: Mar 15 '07
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's Avatar
Site Addict
 
Join Date: Feb 2007
Posts: 579
#2: Mar 15 '07

re: Textbox retrieving multiple values


Quote:

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

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
  3. System.EventArgs) Handles MyBase.Load
  4.  
  5.    ComboBox1.Items.Add("Nancy Davolio")
  6.    Microsoft.VisualBasic.Compatibility.VB6. _
  7.       SetItemData(ComboBox1, ComboBox1.Items.Count() - 1, 12345)
  8.  
  9.    ComboBox1.Items.Add("Judy Phelps")
  10.    Microsoft.VisualBasic.Compatibility.VB6. _
  11.       SetItemData(ComboBox1, ComboBox1.Items.Count() - 1, 67890)
  12. End Sub
  13.  
  14.  
  15. Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, _
  16. ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
  17.  
  18.    Label1.Text = "Employee #" & CStr( _
  19.    Microsoft.VisualBasic.Compatibility.VB6. _
  20.       GetItemData(ComboBox1, ComboBox1.SelectedIndex))
  21. End Sub
  22.  
try it
:)
Reply