Forum » Programiranje » Težava z array v Visual Basic
Težava z array v Visual Basic
DirtyS ::
zanima me, zakaj v naslednji kodi ne morem uporabiti ubound:
Dim kombinacija(t - 1) As String
kombinacija(t - 1) = CStr(CheckedListBox1.CheckedItems(t - 1))
If kombinacija(t - 1) = "2106-1227" Then
Dim x(0 To 6), y(0 To 6) As Double
y(0) = 455271
x(0) = 123544
y(1) = 455375
x(1) = 123556
y(2) = 455378
x(2) = 123545
y(3) = 455381
x(3) = 123502
y(4) = 455310
x(4) = 123502
y(5) = 455295
x(5) = 123504
y(6) = 455272
x(6) = 123504
ElseIf kombinacija(t - 1) = "2106-1228" Then
Dim x(0 To 3), y(0 To 3) As Double
y(0) = 455272
x(0) = 123551
y(1) = 455271
x(1) = 123544
y(2) = 455272
x(2) = 123504
y(3) = 455202
x(3) = 123513
ElseIf kombinacija(t - 1) = "2119-543" Then
Dim x(0 To 9), y(0 To 9) As Double
y(0) = 455381
x(0) = 123495
y(1) = 455306
x(1) = 123494
y(2) = 455299
x(2) = 123494
y(3) = 455205
x(3) = 123494
y(4) = 455194
x(4) = 123509
y(5) = 455202
x(5) = 123513
y(6) = 455272
x(6) = 123504
y(7) = 455295
x(7) = 123504
y(8) = 455310
x(8) = 123502
y(9) = 455381
x(9) = 123502
End If
Dim i As Integer
Dim sum1 As Double = 0
Dim sum2 As Double = 0
For i = 0 To UBound(Y)
Dim kombinacija(t - 1) As String
kombinacija(t - 1) = CStr(CheckedListBox1.CheckedItems(t - 1))
If kombinacija(t - 1) = "2106-1227" Then
Dim x(0 To 6), y(0 To 6) As Double
y(0) = 455271
x(0) = 123544
y(1) = 455375
x(1) = 123556
y(2) = 455378
x(2) = 123545
y(3) = 455381
x(3) = 123502
y(4) = 455310
x(4) = 123502
y(5) = 455295
x(5) = 123504
y(6) = 455272
x(6) = 123504
ElseIf kombinacija(t - 1) = "2106-1228" Then
Dim x(0 To 3), y(0 To 3) As Double
y(0) = 455272
x(0) = 123551
y(1) = 455271
x(1) = 123544
y(2) = 455272
x(2) = 123504
y(3) = 455202
x(3) = 123513
ElseIf kombinacija(t - 1) = "2119-543" Then
Dim x(0 To 9), y(0 To 9) As Double
y(0) = 455381
x(0) = 123495
y(1) = 455306
x(1) = 123494
y(2) = 455299
x(2) = 123494
y(3) = 455205
x(3) = 123494
y(4) = 455194
x(4) = 123509
y(5) = 455202
x(5) = 123513
y(6) = 455272
x(6) = 123504
y(7) = 455295
x(7) = 123504
y(8) = 455310
x(8) = 123502
y(9) = 455381
x(9) = 123502
End If
Dim i As Integer
Dim sum1 As Double = 0
Dim sum2 As Double = 0
For i = 0 To UBound(Y)
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | vba arrayOddelek: Programiranje | 915 (608) | Vazelin |
» | [VBA]ExcelOddelek: Programiranje | 1118 (1076) | mmaestro |
» | Šah [Pacsal]Oddelek: Programiranje | 2211 (1814) | NeOman |
» | n kraljicOddelek: Programiranje | 1468 (1306) | Thomas |
» | hello worldOddelek: Programiranje | 1382 (862) | Thomas |