none
Small Basic to Visual Basic RRS feed

  • Question

  • So I followed all the steps in graduating my code to Visual Basic. I used this "https://social.technet.microsoft.com/wiki/contents/articles/29059.small-basic-instructions-to-graduate-and-debug-with-visual-studio.aspx".

    I got one error 'BC30068'. Which is "A statement attempts to assign a value to an expression. You can assign a value only to a writable variable, property, or array element at run time."

    I looked around for a little bit and I don't know what to do.

    Module Grid_55Module Dim x, size, i, j, box, counter, point, y, x1, y1, m, b, boxes, x2, y2, row, column As Primitive Sub Main() 'code For Grid_55Module.i = 1 To 10 'rows For Grid_55Module.j = 1 To 10 'columns box(i)(j) = Shapes.AddRectangle(size, size) 'the boxes are in an array Shapes.Move(box(i)(j), (j - 1) * size, (i - 1) * size) Next Next 'code End Sub

     Sub OnMouseDown()

    'code

    Endsub

    Monday, March 26, 2018 9:01 PM

All replies

  • I got one error 'BC30068'. Which is "A statement attempts to assign a value to an expression. You can assign a value only to a writable variable, property, or array element at run time."I

    The graduate program does not make your program into a .Net program - it simply allows your small basic code to run in the IDE with minimal modifications.  To create a .Net version of your application you need to make significant changes.  For instance, you would first change you variable declarations to be specific for type as well as array size. (That will also allow the IDE to provide more accurate comments for any errors.)

    This is because in small basic your variable declarations have relied on defaults, and I don't think you got what you expected.    box(i)(j) is a jagged array when what you probably meant was a simple 2-dimensional (rectangular) array: box(i,j).

    https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/arrays/

    Monday, March 26, 2018 11:11 PM