zerotoleranc Posted April 26, 2005 Posted April 26, 2005 OK guys Here is a summary of my problem. I have been trying for a few days now to get Text from a listbox that is connected to a field in an Access Database Table and put it in an array. It says that the value is String and it is looking for an Integer. any suggestions?? HELP. here is the code: Dim Sales(100, 4) As String Dim R As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load OleDbDataAdapter1.Fill(DataSet21) QtyTextBox.Text = "" End Sub Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click Dim wk1 As String Sales(R, 0) = QtyTextBox.Text Sales(R, 1) = DescListBox.Items(DescListBox.SelectedIndex).ToString() ^^^^^Here is where I am haveing the problem^^^^^^^ wk1 = DescListBox.Items(DescListBox.SelectedIndex).ToString() Sales(R, 2) = priceTextBox.Text Sales(R, 3) = Integer.Parse(Sales(R, 0)) * Decimal.Parse(Sales(R, 2)) ' R = R + 1 End Sub Private Sub viewButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles viewButton.Click Dim R1 As Integer Dim item As String item = Sales(R1, 0) & ControlChars.NewLine & Sales(R1, 1) & ControlChars.NewLine & Sales(R1, 2) & ControlChars.NewLine & Sales(R1, 3) 'For R1 = 0 To R ListBox1.Items.Add(item) ' Next End Sub Quote
zerotoleranc Posted April 26, 2005 Author Posted April 26, 2005 ok, here it is 11 hours later and I have figured it out. I replace the line with the error to read... Sales(R, 1) = DescListBox.GetItemText(DescListBox.SelectedItem) yea, I know it was probably simple but, It works and I'm happy 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.