Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...