fguihen Posted November 21, 2005 Posted November 21, 2005 ok, if i bind a list box for example to a table so that it displays products. when a user selects the product, and adds it to a their shopping list table, i dont want the product name added, which is displayed in the list box or combo box or whatever you want to use. instead i want the product_Id added to the shopping list table. how can i do this without hard coding the product id into the application. when a product name is selected, the product id is added to the table? Quote
Denaes Posted November 21, 2005 Posted November 21, 2005 Set the DisplayMember in the Shopping List display to whatever column the Product_ID is called. Quote
fguihen Posted November 21, 2005 Author Posted November 21, 2005 i dont think that will help. you see i want the user to see the product name, but if they select the product_ name, the product_ id is added to the shopping list. the user should never see the product_id though.its just a unique number Quote
Denaes Posted November 21, 2005 Posted November 21, 2005 Sorry, I must have misread what you did want to happen. Then change the displaymember so that the ProductName shows up on the list. If you have a datagrid and don't want to show that column, then set the columns property of Visible to false. If it's not a datagrid I'm not sure why you would be displaying a productID unless you selected to display the ProductID field. You might have to provide more information and/or upload a sample of what you're trying to do. Quote
fguihen Posted November 21, 2005 Author Posted November 21, 2005 kinda got it sorted. when i select a value in the list box, say "sony television", i want to place the id value for that product in the shopping list, something like "sy_tv_001". i bound the list box to the product table, the visible item is set to the product column and the value item is set to the product_ id_column. so when i select a product, i can pull the id associated with it from the value item property. sorry for not explaining properly. now, if only i knew how to add all this data pulled from list boxes and text boxes to a datagrid?thanks for your help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.