BlueOysterCult Posted February 8, 2004 Posted February 8, 2004 Hello everyone I haven't a clue as to how ... to get a selected items "features" ie if someone selects a car from the list (ListBox) 2004 Chevy S-10 into the provided text boxes for those features. The features being air conditoining, color etc. So if I were to select the chevy.. the text boxes would list those features> the text box for air cond would have the value "true" > the text box would have the value "red" I am lost with this one. Can someone give me an idea? am I over explaining it? Thanks Rob Quote
BlueOysterCult Posted February 8, 2004 Author Posted February 8, 2004 I kind of want to do something like this:(?) Public Sub FillTextBoxes(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim index As Integer '= CarArrayList(0) Dim intCurrent As Integer intCurrent = (0) If index <> -1 Then txtPrice.Text = CarArrayList(2) txtMake.Text = CarArrayList(intCurrent) txtYear.Text = CarArrayList(intCurrent) txtIntColor.Text = CarArrayList(intCurrent) txtExtColor.Text = CarArrayList(intCurrent) End If End Sub Rob Quote
*Experts* DiverDan Posted February 8, 2004 *Experts* Posted February 8, 2004 I'm assumming that there are several list boxes that are using this sub and not just one. I'm not at a VB.Net site but try this. Public Sub FillTextBoxes(ByVal ctrl as Control) If ctrl.SelectedIndex < 0 Then Exit Sub txtPrice.Text = CarArrayList(2) txtMake.Text = CarArrayList(ctrl.SelectedIndex) 'etc... End Sub Then call the sub from the list boxes selected index changed event... FillTextBoxes(DirectCast(sender, ListBox)) I think that should work... Dan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
*Experts* DiverDan Posted February 8, 2004 *Experts* Posted February 8, 2004 Opps...you might want to change the ByVal ctrl as Control to ByVal ctrl as ListBox in the FillTextBoxes sub Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
BlueOysterCult Posted February 8, 2004 Author Posted February 8, 2004 Thanks DiverDan I actually have a 1 comboBox (sorry)- I am able to display the list of cars to choose from - there are 11 in the array. Does that make a difference? R Quote
*Experts* DiverDan Posted February 9, 2004 *Experts* Posted February 9, 2004 Yes, it does. I think you're going to need a series of arrays for this. 1. Car manufactures - Manufactures() 2. The manufacture's Models - GM(x, y) & Ford(x, y) etc. where (x) are the models & years and (y) are the features. The various paint choices can be in a csv format in a section of the array and broken out when needed. without getting too deep into this I think that will give you an idea. Is this close to want you are doing? Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
BlueOysterCult Posted February 9, 2004 Author Posted February 9, 2004 thanks Diver I have everything under control R 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.