When writing this code, did you completely ignore what Intellisense
was telling you ? Does the ListBox.ObjectCollection have ANY property
called "Selected" ? You should be using ListBox.SelectedIndex or
ListBox.SelectedItem.ToString().

I'm ignoring the rest of the problems with the code since you are
obviously beginning to learn.

On Apr 28, 10:54 am, gagandeep sharma <[email protected]> wrote:
> hi evry1
>
> i'm creating a application in vb.net in which there are three textbox
> contol, one listbox contol,and  one button.
> in listbox control there are three values , addition, subtraction and
> multiplication
> and my problem is taking values from  two textbox contol, then selct one of
> the value from listbox contol and clicking  on submit button the possible
> result display in third textbox ,but when i select one of the value from
> listbox contol there is a runtime error-- missingmember exception.
>
> if any one can have any ideas then pls help me-- the code of my program is
> given below
>
> Public Class Form1
>
> Dim a As Integer
>
> Dim b As Integer
>
> Dim c As Integer
>
> Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal
> e AsSystem.EventArgs)
> Handles TextBox2.TextChanged
>
> End Sub
>
> Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal
> e AsSystem.EventArgs)
> Handles TextBox1.TextChanged
>
> End Sub
>
> Public Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
> ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
>
> End Sub
>
> Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal
> e AsSystem.EventArgs)
> Handles TextBox3.TextChanged
>
> End Sub
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
> AsSystem.EventArgs)
> Handles Button1.Click
>
> If ListBox1.Items(0).Selected Then
>
> a = TextBox1.Text
>
> b = TextBox2.Text
>
> c = a + b
>
> TextBox3.Text = c
>
> End If
>
> If ListBox1.Items(1).Selected Then
>
> a = TextBox1.Text
>
> b = TextBox2.Text
>
> c = a - b
>
> TextBox3.Text = c
>
> End If
>
> If ListBox1.Items(2).Selected Then
>
> a = TextBox1.Text
>
> b = TextBox2.Text
>
> c = a * b
>
> TextBox3.Text = c
>
> End If
>
> End Sub
>
> End Class
>
> --
> GO and LEAD from Whereever You are.
> Think Big and Think Fast.

Reply via email to