Public Class frmCommand
    Private Sub Command1_Click()

        Dim txtInput1 As Double
        Dim txtInput2 As Integer
        Dim txtInput As Integer
        Dim Sum As Integer
        Dim Average As Integer
        Dim Larger As Integer
        Dim Smallest As Integer


        Sum.Caption = "Sum : " & (Val(txtInput1.Text) + Val(txtInput2.Text) + Val(txtInput3.Text))

        Average.Caption = "Average : " & ((Val(txtInput1.Text) + Val(txtInput2.Text) + Val(txtInput3.Text)) / 3)



        If Val(txtInput1.Text) < Val(txtInput2.Text) And Val(txtInput1.Text) < Val(txtInput3.Text) Then

            Smallest.Caption = "Smallest : " & Text1.Text

        ElseIf Val(txtInput2.Text) < Val(txtInput1.Text) And Val(txtInput2.Text) < Val(3.Text) Then

            Smallest.Caption = "Smallest : " & txtInput2.Text

        ElseIf Val(txtInput3.Text) < Val(txtInput1.Text) And Val(txtInput3.Text) < Val(txtInput1.Text) Then

            Smallest.Caption = "Smallest : " & txtInput3.Text

        End If



        If Val(txtInput1.Text) > Val(txtInput2.Text) And Val(txtInput1.Text) > Val(txtInput3.Text) Then

            Larger.Caption = "Larger : " & txtInput1.Text

        ElseIf Val(txtInput2.Text) > Val(txtInput1.Text) And Val(txtInput2.Text) > Val(txtInput3.Text) Then

            Larger.Caption = "Larger : " & txtInput2.Text

        ElseIf Val(txtInput3.Text) > Val(txtInput1.Text) And Val(txtInput3.Text) > Val(txtInput1.Text) Then

            Larger.Caption = "Larger : " & txtInput3.Text

        End If



    End Sub
End Class

Here are my compile errors

Error   1   'Caption' is not a member of 'Integer'. l     13    9   
Error   2   'Text' is not a member of 'Double'.     13  39  
Error   3   'Text' is not a member of 'Integer'.        13  61

Recommended Answers

All 13 Replies

this code i posting to you in your previous thread.
delete all variable declared in your code. you don't have to declare cause you have it as label name.

Dim txtInput1 As Double
Dim txtInput2 As Integer
Dim txtInput As Integer
Dim Sum As Integer
Dim Average As Integer
Dim Larger As Integer
Dim Smallest As Integer

so you just delete all variable and use label to display result.
and my question is, this program do in vb.net???

I am a little confused because I tried to delete all the variables like you said and I came up with all the variable saying they needed to be declared. Can you show me an example please?

My Teacher said I need a Use a List Box, the program should display the following:
a. each number input in the order entered by the user
b. the sum
c. the average
d. the product
e. the smallest of these numbers of the three numbers
f. the largest of these numbers of the three numbers
g. Make sure you include descriptions as to what each number represents (in other words…don’t just provide a bunch of numbers…).

So I made a form that had a list box with 3 text boxes but I am confused on how to see the results. So far I have a list box, 3 text boxes that are for the input. What kind of box do I need to view the results? This is so confusing and she doesn't help very well. Can somebody show me please. I am more of a visual person.

First think...!!!
i want to know in vb 6 or vb.net you worked this project??

i guest you do this in vb.net cause in your example code use class.right??

Yes your correct its VB.Net I'm pretty sure. Could you please help me out with this; My brain is getting ready to explode from trying so many different things.

if u using vb.net it means you in wrong forum.
i don't understand for points c and g.
see example in attachment...

How did you make your form too look like that?? I notice you used cmd instead of txt....I was wondering if that was a text box you used, because it said Input next to where you input the numbers and the list box in the code said label (lbl) with result below it. You have been a great help too me so far it is starting to sink in believe it or not!!

i didn't understand..what do you want?? this is a really simple program...

I notice you used cmd instead of txt....I was wondering if that was a text box you used, because it said Input next to where you input the numbers

you did not understand my program! i m not using cmd instead of text box. i just make it more simple!
what different if you input 3 numbers in a same time with 3 text box than you input 3 numbers one by one with 1 text box?? its a same way to use both, it cause the numbers will sorted to get smallest and largest. so i prefer to use one textbox to input it one by one and its not a instead of textbox!!

To the Right of Input I am putting a textbox, using a button for Add and Calculate and naming them cmdAdd and cmd Calculate..Then for Results I simply put a label and name it lblResult, which is enclosed by a listbox. Am I doing the Form Correctly because it surely doesn't operate like yours

Disregard the last reply

OK. this is a simple program. i think you have done with this and not need my help again.
happy coding friend :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.