Basically im having problems programming an array as double.

I have it as ' public arrytotal() as double ', however i keep getting the error messages

1. Error 5 Operator '+' is not defined for types '2-dimensional array of Double' and '2-dimensional array of Double'. C:\Users\Alex\Documents\Cafe Assignment\Cafe Assignmentconverthome\Backup\WindowsApplication2\Form2.vb 115 22 WindowsApplication2


and

2. Error 1 Value of type 'Double' cannot be converted to '2-dimensional array of Double'. C:\Users\Alex\Documents\Cafe Assignment\Cafe Assignmentconverthome\Backup\WindowsApplication2\Form2.vb 84 19 WindowsApplication2

is it possible to program an dynamic array as a double? i have seen examples of this online, but cannot seem to do it.

any help would be great,

cheers!

Hi, yeah basically i have the array declared as

Public anscapp() As Double

and the code for my combo box is as follows:


Private Sub Combocapp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combocapp.SelectedIndexChanged


anscapp = Val(Combocapp.Text) * 2.35

End sub

this is all i have for now, im basically trying to turn anscapp (which im using as to represent the value of combocapp, the combo box) into an array. or alternatively to create an array which will store every value that the user selects from the combo box. is this possible?

maybe i should leave anscapp as a double (and not an array) as it is also used in the code which calculates the value. however i need an array to record the values entered by the user into combocapp.

cheers!

If you just want to keep remembering values then use a List as it dynamically resizes for you.

Public anscapp As New List<Double>()

Then you can add elements like so...

anscapp.Add(Double.Parse(Combocapp.Text) * 2.35);

Thanks fungus, however ive added that and im getting the error message telling me 'end of statement expected' im sure its only something small i need to do but is there any chance you could tell me what it is?

I've also generated a class list when prompted, assuming that was what i was meant to?

cheers!

I replied to your personal message, but to clarify I made a "boo boo" in the above code listing (Context change from C# to VB.Net produced a nice schoolboy error :D)

Anyway the above code listing should look like the following for generic types in VB.Net

Public anscapp As New List(Of Double)
This article has been dead for over six months. Start a new discussion instead.