I have a program that through a combo box the user can select a car (which is from a textfile) I want to use a button to search through the file and display the model and make of the car into seperate textboxes. One textbox for 'Make' and a nex for 'Model'.When the button is pressed I want it to calculate the index number of the selected item and display the matching items in the array.Here is what is in the txt file:"D1zzy", "Renault", "Clio""M14SMA", "Porsche", "Boxster""VB61DEX", "Ford", "Capri""B007OND", "Aston Marting", "DB6"And my Code that i have attempted to write is like this: Option Strict OffOption Explicit OnFriend Class FormMain Inherits System.Windows.Forms.Form Private arrVehicle(12) As String#Region "Windows Form Designer generated code "#End Region
Private Sub SearchButt_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles SearchButt.Click Dim strRegNum As String 'the Registration Number Dim strMake As String Dim strModel As String Dim strFile As String 'declare a string variable Dim intCurrentItem As String 'intCurrentItem = 0 strFile = "N:/Bless Folder/Year 2/WINPRO/Week_05/AutoMationSt/Autolist.txt" FileOpen(1, strFile, OpenMode.Input) 'open file and retrieve data Do Until EOF(1) Input(1, strRegNum) Input(1, strMake) Input(1, strModel) cboRegNo.Items.Add(strRegNum) txtRegNum.Text = cboRegNo.SelectedItem txtMake.Text = strMake txtModel.Text = strModel arrVehicle(intCurrentItem) = strMake 'intCurrentItem = intCurrentItem + 1 Loop FileClose(1)
'txtMake.Text = cboRegNo.SelectedItem 'txtModel.Text = cboRegNo.SelectedItem 'A Run Search button which calculates the 'index number of the selected item and displays the matching items in the array End Sub
Private Sub FormMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strRegNum As String 'the Registration Number Dim strMake As String Dim strModel As String Dim strFile As String 'declare a string variable strFile = "N:/Bless Folder/Year 2/WINPRO/Week_05/AutoMationSt/Autolist.txt" FileOpen(1, strFile, OpenMode.Input) 'open file and retrieve data Do Until EOF(1) Input(1, strRegNum) Input(1, strMake) Input(1, strModel) cboRegNo.Items.Add(strRegNum) Loop FileClose(1)
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub
Private Sub cboRegNo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboRegNo.SelectedIndexChanged
End SubEnd ClassI just really would like to understand what it is that i have to do, because i have tried to do it, but its not doing it. Thanks everyone