Forumi


Povratak   PC Ekspert Forum > Računala > Software > Web dizajn, programiranje i ostalo
Ime
Lozinka

Odgovori
 
Uređivanje
Staro 07.02.2009., 17:12   #1
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
VISUAL BASIC pomoć !

Ovako, imam jako dugi kod u formi, te mi piše da zauzima previše prostora pa ne radi. U formi imam padajući izbornik (hdcp), imam text box (r), i još nekih koji nisu sada važni, i naravno button. Svaki kod počinje sa if ndcp="broj", pa ih imam puno, sada bi ja htio, svaki taj kod u neki poseban file stavit (neznam jel su to moduli ili šta), tako kada bi u formi odabro u padajućem izborniku npr br. 17, a u boxu "r" se upiše jedan broj, tada forma pozove u sebe taj cijeli file s kodom i obradi informaciju (u donjem primjeru možete vidjet). Napominjem da su ti kodovi još veći i dugački, ja sam to samo skratio na minimum, pa da vas pitam jel je ovakvo šta moguće napravit u vb6? Unaprijed hvala.


'--glavna forma--
If hdcp = "17" Then
Call nešto1
End If

If hdcp = "18" Then
Call nešto2
End If
'--zavšava forma--

'ovo je znači izvan forme, treba dodat u formu! Iz nekog filea.
'nešto1 (neki file)
If r18 > "5" Then n18 = "0"
If r18 = "5" Then n18 = "1"
If r18 = "4" Then n18 = "2"
If r18 = "3" Then n18 = "3"
If r18 = "2" Then n18 = "4"
If r18 = "1" Then n18 = "5"
End If

'ovo je drugi file
'nešto2 (neki file)
If r2 > "5" Then n2 = "1"
If r2 = "5" Then n2 = "2"
If r2 = "4" Then n2 = "3"
If r2 = "3" Then n2 = "4"
If r2 = "2" Then n2 = "5"
If r2 = "1" Then n2 = "6"

Ako treba mogu vam uplodat program pa dati link.
malixx je offline   Reply With Quote
Staro 08.02.2009., 17:50   #2
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120
daj reci sta taj program uopce radi, tj. sta bi trebao radit?
ovo tu hrpa r-ova pa neki fajl... uopce ne kuzim sta oces.
__________________
noobinator je offline   Reply With Quote
Oglasni prostor
Oglas
 
Oglas
Staro 09.02.2009., 17:18   #3
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76


A kak da ti objasnim, evo ti slika pa vidi, to je program koji računa handicap,
upišeš unutra score, recimo broj od 2-8 i onda on izračuna bruto i neto.

Samo je prepuno koda, svaki ovaj hdcp u padajućem je dug, pa bi taj svaki hdcp stavio posebno, jer ne stane unutra sve.. kužiš?

Mogu ti te kodove napisat recimo u word, i uplodam program, s tim fileovima, pa probaj ubacit ako me kužiš.

Zadnje izmijenjeno od: malixx. 11.02.2009. u 18:57.
malixx je offline   Reply With Quote
Staro 09.02.2009., 20:43   #4
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120
ako sam te skužio:
za svaki 'hdcp' u padajućem izborniku napravio si kod koji računa bruto i neto.

kod možeš pojednostavit ako napraviš funkciju:

Public Sub IzracunajBN (hdcp as integer)

' tu ide kod koji racuna

End Sub

Funkciju pozivaš:
IzračunajBN ( Cint(Combo1.Text))


__________________
noobinator je offline   Reply With Quote
Staro 10.02.2009., 17:53   #5
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
Code:
Private Sub Command1_Click()
   '------score zbroj - GLAVNI KOD, KOD KOJI SE NE PONAVLJA --------

   a = Val(r1) + Val(r2) + Val(r3) + Val(r4) + Val(r5) + Val(r6) + Val(r7) + Val(r8) + Val(r9)
   b = Val(r10) + Val(r11) + Val(r12) + Val(r13) + Val(r14) + Val(r15) + Val(r16) + Val(r17) + Val(r18)
   tot = Val(a) + Val(b)
   rout = a
   rin = b
   rtot = tot
   'bruto
   bruto1 = Val(b1) + Val(b2) + Val(b3) + Val(b4) + Val(b5) + Val(b6) + Val(b7) + Val(b8) + Val(b9)
   bruto2 = Val(b10) + Val(b11) + Val(b12) + Val(b13) + Val(b14) + Val(b15) + Val(b16) + Val(b17) + Val(b18)
   bout = bruto1
   bin = bruto2
   btot = Val(bruto1) + Val(bruto2)
   'neto
   neto1 = Val(n1) + Val(n2) + Val(n3) + Val(n4) + Val(n5) + Val(n6) + Val(n7) + Val(n8) + Val(n9)
   neto2 = Val(n10) + Val(n11) + Val(n12) + Val(n13) + Val(n14) + Val(n15) + Val(n16) + Val(n17) + Val(n18)
   nout = neto1
   nin = neto2
   ntot = Val(neto1) + Val(neto2)

'--------ZAVRŠAVA GLAVNI KOD, SAD SLIJEDE IF HDCP OD 0-36...-------
'JA SAM DAO SAMO DVA PRIMJERA, 22 I 17


'PROBAJ IZVADIT KOD IZ FORME,NAPISAT NA NEKI DRUGI FILE,I ONDA GA UBACIT,TAK BI ZA SVAKI NAPRAVIO AKO SE DA...
If hdcp = "22" Then'-----------------PRVI KOD---------------------
   If r1 >= "6" Then b1 = "0"
   If r1 = "5" Then b1 = "1"
   If r1 = "4" Then b1 = "2"
   If r1 = "3" Then b1 = "3"
   If r1 = "2" Then b1 = "4"
   If r1 > "6" Then n1 = "0"
   If r1 = "6" Then n1 = "1"
   If r1 = "5" Then n1 = "2"
   If r1 = "4" Then n1 = "3"
   If r1 = "3" Then n1 = "4"
   If r1 = "2" Then n1 = "5"
   
   If r2 >= "5" Then b2 = "0"
   If r2 = "4" Then b2 = "1"
   If r2 = "3" Then b2 = "2"
   If r2 = "2" Then b2 = "3"
   If r2 = "1" Then b2 = "4"
   If r2 > "5" Then n2 = "0"
   If r2 = "5" Then n2 = "1"
   If r2 = "4" Then n2 = "2"
   If r2 = "3" Then n2 = "3"
   If r2 = "2" Then n2 = "4"
   If r2 = "1" Then n2 = "5"
   
   If r3 >= "5" Then b3 = "0"
   If r3 = "4" Then b3 = "1"
   If r3 = "3" Then b3 = "2"
   If r3 = "2" Then b3 = "3"
   If r3 = "1" Then b3 = "4"
   If r3 > "5" Then n3 = "0"
   If r3 = "5" Then n3 = "1"
   If r3 = "4" Then n3 = "2"
   If r3 = "3" Then n3 = "3"
   If r3 = "2" Then n3 = "4"
   If r3 = "1" Then n3 = "5"
   
   If r4 >= "5" Then b4 = "0"
   If r4 = "4" Then b4 = "1"
   If r4 = "3" Then b4 = "2"
   If r4 = "2" Then b4 = "3"
   If r4 = "1" Then b4 = "4"
   If r4 > "5" Then n4 = "0"
   If r4 = "5" Then n4 = "1"
   If r4 = "4" Then n4 = "2"
   If r4 = "3" Then n4 = "3"
   If r4 = "2" Then n4 = "4"
   If r4 = "1" Then n4 = "5"
   
   If r5 >= "6" Then b5 = "0"
   If r5 = "5" Then b5 = "1"
   If r5 = "4" Then b5 = "2"
   If r5 = "3" Then b5 = "3"
   If r5 = "2" Then b5 = "4"
   If r5 > "6" Then n5 = "0"
   If r5 = "6" Then n5 = "1"
   If r5 = "5" Then n5 = "2"
   If r5 = "4" Then n5 = "3"
   If r5 = "3" Then n5 = "4"
   If r5 = "2" Then n5 = "5"
   
   If r6 >= "6" Then b6 = "0" 'promjenjena
   If r6 = "5" Then b6 = "1"
   If r6 = "4" Then b6 = "2"
   If r6 = "3" Then b6 = "3"
   If r5 = "2" Then b6 = "4"
   If r6 > "7" Then n6 = "0"
   If r6 = "7" Then n6 = "1"
   If r6 = "6" Then n6 = "2"
   If r6 = "5" Then n6 = "3"
   If r6 = "4" Then n6 = "4"
   If r6 = "3" Then n6 = "5"
   If r6 = "2" Then n6 = "6"
   
   If r7 >= "5" Then b7 = "0" 'promjenjena
   If r7 = "4" Then b7 = "1"
   If r7 = "3" Then b7 = "2"
   If r7 = "2" Then b7 = "3"
   If r7 = "1" Then b7 = "4"
   If r7 > "6" Then n7 = "0"
   If r7 = "6" Then n7 = "1"
   If r7 = "5" Then n7 = "2"
   If r7 = "4" Then n7 = "3"
   If r7 = "3" Then n7 = "4"
   If r7 = "2" Then n7 = "5"
   If r7 = "1" Then n7 = "6"
   
   If r8 >= "5" Then b8 = "0"
   If r8 = "4" Then b8 = "1"
   If r8 = "3" Then b8 = "2"
   If r8 = "2" Then b8 = "3"
   If r8 = "1" Then b8 = "4"
   If r8 > "5" Then n8 = "0"
   If r8 = "5" Then n8 = "1"
   If r8 = "4" Then n8 = "2"
   If r8 = "3" Then n8 = "3"
   If r8 = "2" Then n8 = "4"
   If r8 = "1" Then n8 = "5"
   
   If r9 >= "5" Then b9 = "0"
   If r9 = "4" Then b9 = "1"
   If r9 = "3" Then b9 = "2"
   If r9 = "2" Then b9 = "3"
   If r9 = "1" Then b9 = "4"
   If r9 > "5" Then n9 = "0"
   If r9 = "5" Then n9 = "1"
   If r9 = "4" Then n9 = "2"
   If r9 = "3" Then n9 = "3"
   If r9 = "2" Then n9 = "4"
   If r9 = "1" Then n9 = "5"
   
   If r10 >= "6" Then b10 = "0"
   If r10 = "5" Then b10 = "1"
   If r10 = "4" Then b10 = "2"
   If r10 = "3" Then b10 = "3"
   If r10 = "2" Then b10 = "4"
   If r10 > "6" Then n10 = "0"
   If r10 = "6" Then n10 = "1"
   If r10 = "5" Then n10 = "2"
   If r10 = "4" Then n10 = "3"
   If r10 = "3" Then n10 = "4"
   If r10 = "2" Then n10 = "5"
   
   If r11 >= "5" Then b11 = "0"
   If r11 = "4" Then b11 = "1"
   If r11 = "3" Then b11 = "2"
   If r11 = "2" Then b11 = "3"
   If r11 = "1" Then b11 = "4"
   If r11 > "5" Then n11 = "0"
   If r11 = "5" Then n11 = "1"
   If r11 = "4" Then n11 = "2"
   If r11 = "3" Then n11 = "3"
   If r11 = "2" Then n11 = "4"
   If r11 = "1" Then n11 = "5"
   
   If r12 >= "5" Then b12 = "0"
   If r12 = "4" Then b12 = "1"
   If r12 = "3" Then b12 = "2"
   If r12 = "2" Then b12 = "3"
   If r12 = "1" Then b12 = "4"
   If r12 > "5" Then n12 = "0"
   If r12 = "5" Then n12 = "1"
   If r12 = "4" Then n12 = "2"
   If r12 = "3" Then n12 = "3"
   If r12 = "2" Then n12 = "4"
   If r12 = "1" Then n12 = "5"
   
   If r13 >= "5" Then b13 = "0"
   If r13 = "4" Then b13 = "1"
   If r13 = "3" Then b13 = "2"
   If r13 = "2" Then b13 = "3"
   If r13 = "1" Then b13 = "4"
   If r13 > "5" Then n13 = "0"
   If r13 = "5" Then n13 = "1"
   If r13 = "4" Then n13 = "2"
   If r13 = "3" Then n13 = "3"
   If r13 = "2" Then n13 = "4"
   If r13 = "1" Then n13 = "5"
   
   If r14 >= "6" Then b14 = "0"
   If r14 = "5" Then b14 = "1"
   If r14 = "4" Then b14 = "2"
   If r14 = "3" Then b14 = "3"
   If r14 = "2" Then b14 = "4"
   If r14 > "6" Then n14 = "0"
   If r14 = "6" Then n14 = "1"
   If r14 = "5" Then n14 = "2"
   If r14 = "4" Then n14 = "3"
   If r14 = "3" Then n14 = "4"
   If r14 = "2" Then n14 = "5"
   
   If r15 >= "6" Then b15 = "0" 'promjenjena
   If r15 = "5" Then b15 = "1"
   If r15 = "4" Then b15 = "2"
   If r15 = "3" Then b15 = "3"
   If r15 = "2" Then b15 = "4"
   If r15 > "7" Then n15 = "0"
   If r15 = "7" Then n15 = "1"
   If r15 = "6" Then n15 = "2"
   If r15 = "5" Then n15 = "3"
   If r15 = "4" Then n15 = "4"
   If r15 = "3" Then n15 = "5"
   If r15 = "2" Then n15 = "6"
   
   If r16 >= "5" Then b16 = "0" 'promjenjena
   If r16 = "4" Then b16 = "1"
   If r16 = "3" Then b16 = "2"
   If r16 = "2" Then b16 = "3"
   If r16 = "1" Then b16 = "4"
   If r16 > "6" Then n16 = "0"
   If r16 = "6" Then n16 = "1"
   If r16 = "5" Then n16 = "2"
   If r16 = "4" Then n16 = "3"
   If r16 = "3" Then n16 = "4"
   If r16 = "2" Then n16 = "5"
   If r16 = "1" Then n16 = "6"
   
   If r17 >= "5" Then b17 = "0"
   If r17 = "4" Then b17 = "1"
   If r17 = "3" Then b17 = "2"
   If r17 = "2" Then b17 = "3"
   If r17 = "1" Then b17 = "4"
   If r17 > "5" Then n17 = "0"
   If r17 = "5" Then n17 = "1"
   If r17 = "4" Then n17 = "2"
   If r17 = "3" Then n17 = "3"
   If r17 = "2" Then n17 = "4"
   If r17 = "1" Then n17 = "5"
   
   If r18 >= "5" Then b18 = "0"
   If r18 = "4" Then b18 = "1"
   If r18 = "3" Then b18 = "2"
   If r18 = "2" Then b18 = "3"
   If r18 = "1" Then b18 = "4"
   If r18 > "5" Then n18 = "0"
   If r18 = "5" Then n18 = "1"
   If r18 = "4" Then n18 = "2"
   If r18 = "3" Then n18 = "3"
   If r18 = "2" Then n18 = "4"
   If r18 = "1" Then n18 = "5"
   End If

If hdcp = "17" Then  '-----------------DRUGI KOD---------------------
   If r1 >= "6" Then b1 = "0"
   If r1 = "5" Then b1 = "1"
   If r1 = "4" Then b1 = "2"
   If r1 = "3" Then b1 = "3"
   If r1 = "2" Then b1 = "4"
   If r1 > "6" Then n1 = "0"
   If r1 = "6" Then n1 = "1"
   If r1 = "5" Then n1 = "2"
   If r1 = "4" Then n1 = "3"
   If r1 = "3" Then n1 = "4"
   If r1 = "2" Then n1 = "5"
       
   If r2 >= "5" Then b2 = "0"
   If r2 = "4" Then b2 = "1"
   If r2 = "3" Then b2 = "2"
   If r2 = "2" Then b2 = "3"
   If r2 = "1" Then b2 = "4"
   If r2 > "5" Then n2 = "0"
   If r2 = "5" Then n2 = "1"
   If r2 = "4" Then n2 = "2"
   If r2 = "3" Then n2 = "3"
   If r2 = "2" Then n2 = "4"
   If r2 = "1" Then n2 = "5"
   
   If r3 >= "5" Then b3 = "0"
   If r3 = "4" Then b3 = "1"
   If r3 = "3" Then b3 = "2"
   If r3 = "2" Then b3 = "3"
   If r3 = "1" Then b3 = "4"
   If r3 > "5" Then n3 = "0"
   If r3 = "5" Then n3 = "1"
   If r3 = "4" Then n3 = "2"
   If r3 = "3" Then n3 = "3"
   If r3 = "2" Then n3 = "4"
   If r3 = "1" Then n3 = "5"

   If r4 >= "5" Then b4 = "0"
   If r4 = "4" Then b4 = "1"
   If r4 = "3" Then b4 = "2"
   If r4 = "2" Then b4 = "3"
   If r4 = "1" Then b4 = "4"
   If r4 > "5" Then n4 = "0"
   If r4 = "5" Then n4 = "1"
   If r4 = "4" Then n4 = "2"
   If r4 = "3" Then n4 = "3"
   If r4 = "2" Then n4 = "4"
   If r4 = "1" Then n4 = "5"
   
   If r5 >= "6" Then b5 = "0"
   If r5 = "5" Then b5 = "1"
   If r5 = "4" Then b5 = "2"
   If r5 = "3" Then b5 = "3"
   If r5 = "2" Then b5 = "4"
   If r5 > "6" Then n5 = "0"
   If r5 = "6" Then n5 = "1"
   If r5 = "5" Then n5 = "2"
   If r5 = "4" Then n5 = "3"
   If r5 = "3" Then n5 = "4"
   If r5 = "2" Then n5 = "5"
   
   If r6 >= "6" Then b6 = "0"
   If r6 = "5" Then b6 = "1"
   If r6 = "4" Then b6 = "2"
   If r6 = "3" Then b6 = "3"
   If r6 = "2" Then b6 = "4"
   If r6 > "6" Then n6 = "0"
   If r6 = "6" Then n6 = "1"
   If r6 = "5" Then n6 = "2"
   If r6 = "4" Then n6 = "3"
   If r6 = "3" Then n6 = "4"
   If r6 = "2" Then n6 = "5"
   
   If r7 >= "5" Then b7 = "0" 'promjenjena
   If r7 = "4" Then b7 = "1"
   If r7 = "3" Then b7 = "2"
   If r7 = "2" Then b7 = "3"
   If r7 = "1" Then b7 = "4"
   If r7 > "5" Then n7 = "0"
   If r7 = "5" Then n7 = "0"
   If r7 = "4" Then n7 = "1"
   If r7 = "3" Then n7 = "2"
   If r7 = "2" Then n7 = "3"
   If r7 = "1" Then n7 = "4"
   
   If r8 >= "5" Then b8 = "0"
   If r8 = "4" Then b8 = "1"
   If r8 = "3" Then b8 = "2"
   If r8 = "2" Then b8 = "3"
   If r8 = "1" Then b8 = "4"
   If r8 > "5" Then n8 = "0"
   If r8 = "5" Then n8 = "1"
   If r8 = "4" Then n8 = "2"
   If r8 = "3" Then n8 = "3"
   If r8 = "2" Then n8 = "4"
   If r8 = "1" Then n8 = "5"
   
   If r9 >= "5" Then b9 = "0"
   If r9 = "4" Then b9 = "1"
   If r9 = "3" Then b9 = "2"
   If r9 = "2" Then b9 = "3"
   If r9 = "1" Then b9 = "4"
   If r9 > "5" Then n9 = "0"
   If r9 = "5" Then n9 = "1"
   If r9 = "4" Then n9 = "2"
   If r9 = "3" Then n9 = "3"
   If r9 = "2" Then n9 = "4"
   If r9 = "1" Then n9 = "5"
   
   If r10 >= "6" Then b10 = "0"
   If r10 = "5" Then b10 = "1"
   If r10 = "4" Then b10 = "2"
   If r10 = "3" Then b10 = "3"
   If r10 = "2" Then b10 = "4"
   If r10 > "6" Then n10 = "0"
   If r10 = "6" Then n10 = "1"
   If r10 = "5" Then n10 = "2"
   If r10 = "4" Then n10 = "3"
   If r10 = "3" Then n10 = "4"
   If r10 = "2" Then n10 = "5"
       
   If r11 >= "5" Then b11 = "0"
   If r11 = "4" Then b11 = "1"
   If r11 = "3" Then b11 = "2"
   If r11 = "2" Then b11 = "3"
   If r11 = "1" Then b11 = "4"
   If r11 > "5" Then n11 = "0"
   If r11 = "5" Then n11 = "1"
   If r11 = "4" Then n11 = "2"
   If r11 = "3" Then n11 = "3"
   If r11 = "2" Then n11 = "4"
   If r11 = "1" Then n11 = "5"
   
   If r12 >= "5" Then b12 = "0"
   If r12 = "4" Then b12 = "1"
   If r12 = "3" Then b12 = "2"
   If r12 = "2" Then b12 = "3"
   If r12 = "1" Then b12 = "4"
   If r12 > "5" Then n11 = "0"
   If r12 = "5" Then n12 = "1"
   If r12 = "4" Then n12 = "2"
   If r12 = "3" Then n12 = "3"
   If r12 = "2" Then n12 = "4"
   If r12 = "1" Then n12 = "5"
   
   If r13 >= "5" Then b13 = "0"
   If r13 = "4" Then b13 = "1"
   If r13 = "3" Then b13 = "2"
   If r13 = "2" Then b13 = "3"
   If r13 = "1" Then b13 = "4"
   If r13 > "5" Then n13 = "0"
   If r13 = "5" Then n13 = "1"
   If r13 = "4" Then n13 = "2"
   If r13 = "3" Then n13 = "3"
   If r13 = "2" Then n13 = "4"
   If r13 = "1" Then n13 = "5"
   
   If r14 >= "6" Then b14 = "0"
   If r14 = "5" Then b14 = "1"
   If r14 = "4" Then b14 = "2"
   If r14 = "3" Then b14 = "3"
   If r14 = "2" Then b14 = "4"
   If r14 > "6" Then n14 = "0"
   If r14 = "6" Then n14 = "1"
   If r14 = "5" Then n14 = "2"
   If r14 = "4" Then n14 = "3"
   If r14 = "3" Then n14 = "4"
   If r14 = "2" Then n14 = "5"
   
   If r15 >= "6" Then b15 = "0"
   If r15 = "5" Then b15 = "1"
   If r15 = "4" Then b15 = "2"
   If r15 = "3" Then b15 = "3"
   If r15 = "2" Then b15 = "4"
   If r15 > "6" Then n15 = "0"
   If r15 = "6" Then n15 = "1"
   If r15 = "5" Then n15 = "2"
   If r15 = "4" Then n15 = "3"
   If r15 = "3" Then n15 = "4"
   If r15 = "2" Then n15 = "5"
   
   If r16 >= "5" Then b16 = "0"
   If r16 = "4" Then b16 = "1"
   If r16 = "3" Then b16 = "2"
   If r16 = "2" Then b16 = "3"
   If r16 = "1" Then b16 = "4"
   If r16 > "5" Then n16 = "0"
   If r16 = "5" Then n16 = "1"
   If r16 = "4" Then n16 = "2"
   If r16 = "3" Then n16 = "3"
   If r16 = "2" Then n16 = "4"
   If r16 = "1" Then n16 = "5"
   
   If r17 >= "5" Then b17 = "0"
   If r17 = "4" Then b17 = "1"
   If r17 = "3" Then b17 = "2"
   If r17 = "2" Then b17 = "3"
   If r17 = "1" Then b17 = "4"
   If r17 > "5" Then n17 = "0"
   If r17 = "5" Then n17 = "1"
   If r17 = "4" Then n17 = "2"
   If r17 = "3" Then n17 = "3"
   If r17 = "2" Then n17 = "4"
   If r17 = "1" Then n17 = "5"
   
   If r18 >= "5" Then b18 = "0"
   If r18 = "4" Then b18 = "1"
   If r18 = "3" Then b18 = "2"
   If r18 = "2" Then b18 = "3"
   If r18 = "1" Then b18 = "4"
   If r18 > "5" Then n18 = "0"
   If r18 = "5" Then n18 = "1"
   If r18 = "4" Then n18 = "2"
   If r18 = "3" Then n18 = "3"
   If r18 = "2" Then n18 = "4"
   If r18 = "1" Then n18 = "5"
End If

'I TAKO DALJE I DALJE I DALJE... :)
Da tako je, evo sad sam napiso tu kod, napisao sam glavni kod, i 2 koda koja se ponavljaju (napominjem treba biti 36 takvih kodova), a već od par njih kad stavim piše da nema više mjesta, tj previše koda.. nisam baš skužio ono zadnje jer neznam jel si ti mislio na ovakav kod, pogledaj sada ovaj pa mi kaži jel bi se to moglo ubacit odnekud u formu ili neko drugo rješenje.
malixx je offline   Reply With Quote
Staro 10.02.2009., 18:21   #6
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120
malo je to puno koda
a sigurno se to da skratit, samo ja neznam kako se bruto i neto racuna :|

možeš za svaki napravit posebnu funknciju npr. za 22:

Public Sub hdcp22 ()
If r1 >= "6" Then b1 = "0"
If r1 = "5" Then b1 = "1"
If r1 = "4" Then b1 = "2"
If r1 = "3" Then b1 = "3"
If r1 = "2" Then b1 = "4"
If r1 > "6" Then n1 = "0"
If r1 = "6" Then n1 = "1"
If r1 = "5" Then n1 = "2"
If r1 = "4" Then n1 = "3"
If r1 = "3" Then n1 = "4"
If r1 = "2" Then n1 = "5"

If r2 >= "5" Then b2 = "0"
If r2 = "4" Then b2 = "1"
If r2 = "3" Then b2 = "2"
If r2 = "2" Then b2 = "3"
If r2 = "1" Then b2 = "4"
If r2 > "5" Then n2 = "0"
If r2 = "5" Then n2 = "1"
If r2 = "4" Then n2 = "2"
If r2 = "3" Then n2 = "3"
If r2 = "2" Then n2 = "4"
If r2 = "1" Then n2 = "5"

If r3 >= "5" Then b3 = "0"
If r3 = "4" Then b3 = "1"
If r3 = "3" Then b3 = "2"
If r3 = "2" Then b3 = "3"
If r3 = "1" Then b3 = "4"
If r3 > "5" Then n3 = "0"
If r3 = "5" Then n3 = "1"
If r3 = "4" Then n3 = "2"
If r3 = "3" Then n3 = "3"
If r3 = "2" Then n3 = "4"
If r3 = "1" Then n3 = "5"

If r4 >= "5" Then b4 = "0"
If r4 = "4" Then b4 = "1"
If r4 = "3" Then b4 = "2"
If r4 = "2" Then b4 = "3"
If r4 = "1" Then b4 = "4"
If r4 > "5" Then n4 = "0"
If r4 = "5" Then n4 = "1"
If r4 = "4" Then n4 = "2"
If r4 = "3" Then n4 = "3"
If r4 = "2" Then n4 = "4"
If r4 = "1" Then n4 = "5"

If r5 >= "6" Then b5 = "0"
If r5 = "5" Then b5 = "1"
If r5 = "4" Then b5 = "2"
If r5 = "3" Then b5 = "3"
If r5 = "2" Then b5 = "4"
If r5 > "6" Then n5 = "0"
If r5 = "6" Then n5 = "1"
If r5 = "5" Then n5 = "2"
If r5 = "4" Then n5 = "3"
If r5 = "3" Then n5 = "4"
If r5 = "2" Then n5 = "5"

If r6 >= "6" Then b6 = "0" 'promjenjena
If r6 = "5" Then b6 = "1"
If r6 = "4" Then b6 = "2"
If r6 = "3" Then b6 = "3"
If r5 = "2" Then b6 = "4"
If r6 > "7" Then n6 = "0"
If r6 = "7" Then n6 = "1"
If r6 = "6" Then n6 = "2"
If r6 = "5" Then n6 = "3"
If r6 = "4" Then n6 = "4"
If r6 = "3" Then n6 = "5"
If r6 = "2" Then n6 = "6"

If r7 >= "5" Then b7 = "0" 'promjenjena
If r7 = "4" Then b7 = "1"
If r7 = "3" Then b7 = "2"
If r7 = "2" Then b7 = "3"
If r7 = "1" Then b7 = "4"
If r7 > "6" Then n7 = "0"
If r7 = "6" Then n7 = "1"
If r7 = "5" Then n7 = "2"
If r7 = "4" Then n7 = "3"
If r7 = "3" Then n7 = "4"
If r7 = "2" Then n7 = "5"
If r7 = "1" Then n7 = "6"

If r8 >= "5" Then b8 = "0"
If r8 = "4" Then b8 = "1"
If r8 = "3" Then b8 = "2"
If r8 = "2" Then b8 = "3"
If r8 = "1" Then b8 = "4"
If r8 > "5" Then n8 = "0"
If r8 = "5" Then n8 = "1"
If r8 = "4" Then n8 = "2"
If r8 = "3" Then n8 = "3"
If r8 = "2" Then n8 = "4"
If r8 = "1" Then n8 = "5"

If r9 >= "5" Then b9 = "0"
If r9 = "4" Then b9 = "1"
If r9 = "3" Then b9 = "2"
If r9 = "2" Then b9 = "3"
If r9 = "1" Then b9 = "4"
If r9 > "5" Then n9 = "0"
If r9 = "5" Then n9 = "1"
If r9 = "4" Then n9 = "2"
If r9 = "3" Then n9 = "3"
If r9 = "2" Then n9 = "4"
If r9 = "1" Then n9 = "5"

If r10 >= "6" Then b10 = "0"
If r10 = "5" Then b10 = "1"
If r10 = "4" Then b10 = "2"
If r10 = "3" Then b10 = "3"
If r10 = "2" Then b10 = "4"
If r10 > "6" Then n10 = "0"
If r10 = "6" Then n10 = "1"
If r10 = "5" Then n10 = "2"
If r10 = "4" Then n10 = "3"
If r10 = "3" Then n10 = "4"
If r10 = "2" Then n10 = "5"

If r11 >= "5" Then b11 = "0"
If r11 = "4" Then b11 = "1"
If r11 = "3" Then b11 = "2"
If r11 = "2" Then b11 = "3"
If r11 = "1" Then b11 = "4"
If r11 > "5" Then n11 = "0"
If r11 = "5" Then n11 = "1"
If r11 = "4" Then n11 = "2"
If r11 = "3" Then n11 = "3"
If r11 = "2" Then n11 = "4"
If r11 = "1" Then n11 = "5"

If r12 >= "5" Then b12 = "0"
If r12 = "4" Then b12 = "1"
If r12 = "3" Then b12 = "2"
If r12 = "2" Then b12 = "3"
If r12 = "1" Then b12 = "4"
If r12 > "5" Then n12 = "0"
If r12 = "5" Then n12 = "1"
If r12 = "4" Then n12 = "2"
If r12 = "3" Then n12 = "3"
If r12 = "2" Then n12 = "4"
If r12 = "1" Then n12 = "5"

If r13 >= "5" Then b13 = "0"
If r13 = "4" Then b13 = "1"
If r13 = "3" Then b13 = "2"
If r13 = "2" Then b13 = "3"
If r13 = "1" Then b13 = "4"
If r13 > "5" Then n13 = "0"
If r13 = "5" Then n13 = "1"
If r13 = "4" Then n13 = "2"
If r13 = "3" Then n13 = "3"
If r13 = "2" Then n13 = "4"
If r13 = "1" Then n13 = "5"

If r14 >= "6" Then b14 = "0"
If r14 = "5" Then b14 = "1"
If r14 = "4" Then b14 = "2"
If r14 = "3" Then b14 = "3"
If r14 = "2" Then b14 = "4"
If r14 > "6" Then n14 = "0"
If r14 = "6" Then n14 = "1"
If r14 = "5" Then n14 = "2"
If r14 = "4" Then n14 = "3"
If r14 = "3" Then n14 = "4"
If r14 = "2" Then n14 = "5"

If r15 >= "6" Then b15 = "0" 'promjenjena
If r15 = "5" Then b15 = "1"
If r15 = "4" Then b15 = "2"
If r15 = "3" Then b15 = "3"
If r15 = "2" Then b15 = "4"
If r15 > "7" Then n15 = "0"
If r15 = "7" Then n15 = "1"
If r15 = "6" Then n15 = "2"
If r15 = "5" Then n15 = "3"
If r15 = "4" Then n15 = "4"
If r15 = "3" Then n15 = "5"
If r15 = "2" Then n15 = "6"

If r16 >= "5" Then b16 = "0" 'promjenjena
If r16 = "4" Then b16 = "1"
If r16 = "3" Then b16 = "2"
If r16 = "2" Then b16 = "3"
If r16 = "1" Then b16 = "4"
If r16 > "6" Then n16 = "0"
If r16 = "6" Then n16 = "1"
If r16 = "5" Then n16 = "2"
If r16 = "4" Then n16 = "3"
If r16 = "3" Then n16 = "4"
If r16 = "2" Then n16 = "5"
If r16 = "1" Then n16 = "6"

If r17 >= "5" Then b17 = "0"
If r17 = "4" Then b17 = "1"
If r17 = "3" Then b17 = "2"
If r17 = "2" Then b17 = "3"
If r17 = "1" Then b17 = "4"
If r17 > "5" Then n17 = "0"
If r17 = "5" Then n17 = "1"
If r17 = "4" Then n17 = "2"
If r17 = "3" Then n17 = "3"
If r17 = "2" Then n17 = "4"
If r17 = "1" Then n17 = "5"

If r18 >= "5" Then b18 = "0"
If r18 = "4" Then b18 = "1"
If r18 = "3" Then b18 = "2"
If r18 = "2" Then b18 = "3"
If r18 = "1" Then b18 = "4"
If r18 > "5" Then n18 = "0"
If r18 = "5" Then n18 = "1"
If r18 = "4" Then n18 = "2"
If r18 = "3" Then n18 = "3"
If r18 = "2" Then n18 = "4"
If r18 = "1" Then n18 = "5"
End Sub

itd....

onda bi to ovak izgledalo:

Citiraj:
Private Sub Command1_Click()
'------score zbroj - GLAVNI KOD, KOD KOJI SE NE PONAVLJA --------

a = Val(r1) + Val(r2) + Val(r3) + Val(r4) + Val(r5) + Val(r6) + Val(r7) + Val(r8) + Val(r9)
b = Val(r10) + Val(r11) + Val(r12) + Val(r13) + Val(r14) + Val(r15) + Val(r16) + Val(r17) + Val(r18)
tot = Val(a) + Val(b)
rout = a
rin = b
rtot = tot
'bruto
bruto1 = Val(b1) + Val(b2) + Val(b3) + Val(b4) + Val(b5) + Val(b6) + Val(b7) + Val(b8) + Val(b9)
bruto2 = Val(b10) + Val(b11) + Val(b12) + Val(b13) + Val(b14) + Val(b15) + Val(b16) + Val(b17) + Val(b18)
bout = bruto1
bin = bruto2
btot = Val(bruto1) + Val(bruto2)
'neto
neto1 = Val(n1) + Val(n2) + Val(n3) + Val(n4) + Val(n5) + Val(n6) + Val(n7) + Val(n8) + Val(n9)
neto2 = Val(n10) + Val(n11) + Val(n12) + Val(n13) + Val(n14) + Val(n15) + Val(n16) + Val(n17) + Val(n18)
nout = neto1
nin = neto2
ntot = Val(neto1) + Val(neto2)

'--------ZAVRŠAVA GLAVNI KOD, SAD SLIJEDE IF HDCP OD 0-36...-------
'JA SAM DAO SAMO DVA PRIMJERA, 22 I 17


'PROBAJ IZVADIT KOD IZ FORME,NAPISAT NA NEKI DRUGI FILE,I ONDA GA UBACIT,TAK BI ZA SVAKI NAPRAVIO AKO SE DA...
If hdcp = "22" Then hdcp22
if hdcp ="17" Then hdcp17

možeš stavit te funkcije u modul, samo češ onda morat umjesto r1 = "6" pisati form1.r1 = "6". kužiš?





e i da te pitam:
zašto negdje imaš If r = "5" a negdje if r = 6, fali ti kod ili se za svaki r drugacije racuna???
__________________

Zadnje izmijenjeno od: noobinator. 10.02.2009. u 18:32.
noobinator je offline   Reply With Quote
Staro 10.02.2009., 18:42   #7
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
Pa da, gle,
r ti je rupa, imaš od 1-18, svaka je znači drukčija
b ti je izračun bruta
n ti je izračun neta


da bi dobio bruto i neto, moraš upisat znači u svaku rupu svoj
rezultat + izabrati u padajućem izborniku handicap..

gle bilo bi ti jasnije da ti uplodam program, nije velik, pa možeš vidit kak to radi
onda bi i znao kako smanjit toliko kodova..

i daj kad pišeš kod stavi u [code] tagove hehe da ne zauzimaš previše mjesta na forumu

Zadnje izmijenjeno od: malixx. 10.02.2009. u 18:53.
malixx je offline   Reply With Quote
Staro 10.02.2009., 18:49   #8
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120
imas neku formulu po kojoj se racuna to?
daj napisi ju, po necem si radil valjda.

izgubim se u kodu Oo.
__________________

Zadnje izmijenjeno od: noobinator. 10.02.2009. u 19:05.
noobinator je offline   Reply With Quote
Staro 10.02.2009., 19:08   #9
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
rupa 1  2  3  4  5  6  7  8  9   10  11   12   13   14  15   16   17   18
par  4  3  3  3  4  4  3  3  3    4   3    3    3    4   4    3    3    3 
U slučaju sad hdcp 22
Ako odigraš isti broj udarca ko par, to ti je isti bro, npr par 4 = 4 udarca
za par je bruto uvjek 2, u netu se mjenjaju rupa 6-ta i 7-ma ovako,
neto za sve rupe osim 6,7,15,16 je "3", a zate 4 rupe je neto 4

to bi ovak bilo sažeto:
PHP kod:
          br.udaraca
rupa       i par       bruto       neto
1             4           2          3
2             3           2          3
3             3           2          3
4             3           2          3    
5             4           2          3
6             4           2          4
7             3           2          4
8             3           2          3
9             3           2          3

Isto tako i za dr
9 rupa..
Znači ako odigraš isto udaraca ko i par.. bruto i neto dobiješ ovak za svaku rupu kak sam napiso :) 

e sad ako imaš jedan udarac više od paraznači di je 

par 3 ti imaš 1 udarac
to ti je neto "5" (dva ispod para)
par 3 ti imaš 2 udarcato ti je neto "4" (jedan ispod para)
par 3 ti imaš 3 udarcato ti je neto "3" PAR 
par 3 ti imaš 4 udarca
to ti je neto "2", (jedan iznad para)
di ti je par 3 a imaš 5 udarcato ti je neto "1"..
 
di ti je par 3 a imaš 6 udarcato ti je neto "0".. znači nema neta (2 iznad para)

e sad samo na onim označenim rupama (6ta i 7madodaješ jedan neto više :) znači 
 par 3 ti imaš 3 udarca
to ti je neto "4", (jedan iznad para

a kako se znaju koje su označene rupepo indexu rupa :) to ti neću pisat 
Ukratko neka formula ti je:
Na par 3 rupi:

2 udarca ispod para 5 neto
1 udarac ispod para 4 neto
.....................PAR 3 neto
1 udarac iznad para 2 neto
2 udarca iznad para 1 neto
3 udarca iznad para 0 neto
-a za oznacene se dodaje +1 neto

A ovo je bruto: (za SVE par rupe)
Uvjek je isti:

3 udarca ispod para 5 bruto
2 udarca ispod para 4 bruto
1 udarac ispod para 3 bruto
.....................PAR 2 bruto
1 udarac iznad para 1 bruto
2 udarca iznad para 0 bruto
3 udarca iznad para 0 bruto-->
Citiraj:
Autor noobinator Pregled postova
imas neku formulu po kojoj se racuna to?
daj napisi ju, po necem si radil valjda.
izgubim se u kodu Oo.
To je problem, jer kod nije isti, stalno se skoro mjenja, ti očito misliš taj kod
smanjit onako..al to neće ići izgleda jer se mjenja..
aj napisat ću ti neš.

Postoje Provi rupe, u ovom slučaju iamju par 3 i 4

PHP kod:
rupa 1  2  3  4  5  6  7  8  9   10  11   12   13   14  15   16   17   18
par  4  3  3  3  4  4  3  3  3    4   3    3    3    4   4    3    3    3 
U slučaju sad hdcp 22
Ako odigraš isti broj udarca ko par, to ti je isti bro, npr par 4 = 4 udarca
za par je bruto uvjek 2, u netu se mjenjaju rupa 6-ta i 7-ma ovako,
neto za sve rupe osim 6,7,15,16 je "3", a zate 4 rupe je neto 4

to bi ovak bilo sažeto:
PHP kod:
          br.udaraca
rupa       i par       bruto       neto
1             4           2          3
2             3           2          3
3             3           2          3
4             3           2          3    
5             4           2          3
6             4           2          4
7             3           2          4
8             3           2          3
9             3           2          3

Isto tako i za dr
9 rupa..
Znači ako odigraš isto udaraca ko i par.. bruto i neto dobiješ ovak za svaku rupu kak sam napiso :) 

e sad ako imaš jedan udarac više od paraznači di je 

par 3 ti imaš 1 udarac
to ti je neto "5" (dva ispod para)
par 3 ti imaš 2 udarcato ti je neto "4" (jedan ispod para)
par 3 ti imaš 3 udarcato ti je neto "3" PAR 
par 3 ti imaš 4 udarca
to ti je neto "2", (jedan iznad para)
di ti je par 3 a imaš 5 udarcato ti je neto "1"..
 
di ti je par 3 a imaš 6 udarcato ti je neto "0".. znači nema neta (2 iznad para)

e sad samo na onim označenim rupama (6ta i 7madodaješ jedan neto više :) znači 
 par 3 ti imaš 3 udarca
to ti je neto "4", (jedan iznad para

a kako se znaju koje su označene rupepo indexu rupa :) to ti neću pisat 
Ukratko neka formula ti je:
Na par 3 rupi:

2 udarca ispod para 5 neto
1 udarac ispod para 4 neto
.....................PAR 3 neto
1 udarac iznad para 2 neto
2 udarca iznad para 1 neto
3 udarca iznad para 0 neto
-a za oznacene se dodaje +1 neto

A ovo je bruto: (za SVE par rupe)
Uvjek je isti:

3 udarca ispod para 5 bruto
2 udarca ispod para 4 bruto
1 udarac ispod para 3 bruto
.....................PAR 2 bruto
1 udarac iznad para 1 bruto
2 udarca iznad para 0 bruto
3 udarca iznad para 0 bruto

Zadnje izmijenjeno od: malixx. 10.02.2009. u 21:49.
malixx je offline   Reply With Quote
Staro 10.02.2009., 22:02   #10
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120
function bruto (par as integerrez as integer) as integer

Dim bruto_ 
as integer
Dim a 
as integer
rez par
  select 
case a
     
case -2      '2 udarca manje
        bruto_ = 4
     case -1      '
1 udarac manje itd..
        
bruto_ 3
     
case 0
        bruto_ 
2
     
case 1
        bruto_ 
1
     
case is >= 2
        bruto_ 
0
   end select
bruto 
bruto_
end 
function

function 
neto (rupa as integerpar as integerrez as integer) as integer
Dim neto_ 
as integer
Dim a 
as integer
rez par
   select 
case a
       
case -2
         neto_ 
5
       
case -1
         neto_ 
4
       
case 0
         neto_ 
3
       
case 1
         neto_ 
2
       
case 2
         neto_ 
1
       
case is >= 3
         neto_ 
0
   end select

if rupa or rupa or rupa 15 or rupa=16 then neto_ neto_ 1

neto 
neto_

end 
function



' sad negdje di je glavni kod

for i = 1 to 18  

b(i) = bruto ( p(i), r(i) )
n(i) = neto (i, p(i), r(i) )

next i 
provjeri ti jos kod jel to radi kako treba, napravi novi projekt kopiraj ove funkcije pa gledaj jel ispadaju dobri rezultati.-->
imam ideju, napravi kopiju projekta da nebi bilo.

znaci imas boxeve r1,r2,r3..... svim boxevima daj isto ime, r ali različiti index. prvi r ima index 1 drugi 2.... do 18. isto napravi za boxeve bruto,neto i par.


PHP kod:
function bruto (par as integerrez as integer) as integer

Dim bruto_ 
as integer
Dim a 
as integer
rez par
  select 
case a
     
case -2      '2 udarca manje
        bruto_ = 4
     case -1      '
1 udarac manje itd..
        
bruto_ 3
     
case 0
        bruto_ 
2
     
case 1
        bruto_ 
1
     
case is >= 2
        bruto_ 
0
   end select
bruto 
bruto_
end 
function

function 
neto (rupa as integerpar as integerrez as integer) as integer
Dim neto_ 
as integer
Dim a 
as integer
rez par
   select 
case a
       
case -2
         neto_ 
5
       
case -1
         neto_ 
4
       
case 0
         neto_ 
3
       
case 1
         neto_ 
2
       
case 2
         neto_ 
1
       
case is >= 3
         neto_ 
0
   end select

if rupa or rupa or rupa 15 or rupa=16 then neto_ neto_ 1

neto 
neto_

end 
function



' sad negdje di je glavni kod

for i = 1 to 18  

b(i) = bruto ( p(i), r(i) )
n(i) = neto (i, p(i), r(i) )

next i 
provjeri ti jos kod jel to radi kako treba, napravi novi projekt kopiraj ove funkcije pa gledaj jel ispadaju dobri rezultati.
__________________
noobinator je offline   Reply With Quote
Oglasni prostor
Oglas
 
Oglas
Staro 11.02.2009., 17:33   #11
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
E ajde reci jel ovako misliš za sve ??



A kaj s boxevima: "rout,bout,nout,rin,bin,nin,rtot,btot,ntot" ??



.

Zadnje izmijenjeno od: malixx. 11.02.2009. u 18:01.
malixx je offline   Reply With Quote
Staro 11.02.2009., 21:17   #12
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120



function bruto (par as integerrez as integer) as integer

Dim bruto_ 
as integer
Dim a 
as integer
rez par
  select 
case a
     
case -2      '2 udarca manje
        bruto_ = 4
     case -1      '
1 udarac manje itd..
        
bruto_ 3
     
case 0
        bruto_ 
2
     
case 1
        bruto_ 
1
     
case is >= 2
        bruto_ 
0
   end select
bruto 
bruto_
end 
function

function 
neto (par as integerrez as integerhdcp as integer) as integer
Dim neto_ 
as integeras integeras integeras integer
Dim a 
as integer
Dim indeksi 
(1 to 18) as integer
Dim oduzmi 
as boolean

'popuniti indexe
indeksi(1) = 17   '
prva rupa ima index 17
indeksi
(2) = 11
indeksi
(3) = 7
indeksi
(4) = 9
indeksi
(5) = 13
indeksi
(6) = 3
indeksi
(7) = 1
indeksi
(8) = 5
indeksi
(9) = 15
indeksi
(10) = 18   
indeksi
(11) = 12
indeksi
(12) = 8
indeksi
(13) = 10
indeksi
(14) = 14
indeksi
(15) = 4
indeksi
(16) = 2
indeksi
(17) = 6
indeksi
(18) = 16

Abs (hdcp 18)  
if 
hdcp 18 then oduzmi=true 

rez par
   select 
case a
       
case -2
         neto_ 
5
       
case -1
         neto_ 
4
       
case 0
         neto_ 
3
       
case 1
         neto_ 
2
       
case 2
         neto_ 
1
       
case is >= 3
         neto_ 
0
   end select

if 0 then 
neto_ 
neto_ 1
goto hell
end 
if

for 
1 to h

  
for 1 to 18
   
if indeksi(j) = and oduzmi false then neto_ neto 1
   
if indeksi(j) = and oduzmi true then neto_ neto 1
  next j

next i

hell
:

neto neto_

end 
function



 
sad negdje di je glavni kod

Dim hdcp 
as integer
hdcp 
Cint (Combo1.Text)  'ucitaj sta pise u combo1 tj. padajuci izbornik

for i = 1 to 18  

b(i) = bruto ( p(i), r(i) )
n(i) = neto (i, p(i), r(i), hdcp)

next i 

rezultat se spremi u boxeve za bruto, neto. jedino jos moras napraviti da se zbroji sve to.-->
mislim da bi to bilo to (provjeri ipak!):

PHP kod:



function bruto (par as integerrez as integer) as integer

Dim bruto_ 
as integer
Dim a 
as integer
rez par
  select 
case a
     
case -2      '2 udarca manje
        bruto_ = 4
     case -1      '
1 udarac manje itd..
        
bruto_ 3
     
case 0
        bruto_ 
2
     
case 1
        bruto_ 
1
     
case is >= 2
        bruto_ 
0
   end select
bruto 
bruto_
end 
function

function 
neto (par as integerrez as integerhdcp as integer) as integer
Dim neto_ 
as integeras integeras integeras integer
Dim a 
as integer
Dim indeksi 
(1 to 18) as integer
Dim oduzmi 
as boolean

'popuniti indexe
indeksi(1) = 17   '
prva rupa ima index 17
indeksi
(2) = 11
indeksi
(3) = 7
indeksi
(4) = 9
indeksi
(5) = 13
indeksi
(6) = 3
indeksi
(7) = 1
indeksi
(8) = 5
indeksi
(9) = 15
indeksi
(10) = 18   
indeksi
(11) = 12
indeksi
(12) = 8
indeksi
(13) = 10
indeksi
(14) = 14
indeksi
(15) = 4
indeksi
(16) = 2
indeksi
(17) = 6
indeksi
(18) = 16

Abs (hdcp 18)  
if 
hdcp 18 then oduzmi=true 

rez par
   select 
case a
       
case -2
         neto_ 
5
       
case -1
         neto_ 
4
       
case 0
         neto_ 
3
       
case 1
         neto_ 
2
       
case 2
         neto_ 
1
       
case is >= 3
         neto_ 
0
   end select

if 0 then 
neto_ 
neto_ 1
goto hell
end 
if

for 
1 to h

  
for 1 to 18
   
if indeksi(j) = and oduzmi false then neto_ neto 1
   
if indeksi(j) = and oduzmi true then neto_ neto 1
  next j

next i

hell
:

neto neto_

end 
function



 
sad negdje di je glavni kod

Dim hdcp 
as integer
hdcp 
Cint (Combo1.Text)  'ucitaj sta pise u combo1 tj. padajuci izbornik

for i = 1 to 18  

b(i) = bruto ( p(i), r(i) )
n(i) = neto (i, p(i), r(i), hdcp)

next i 

rezultat se spremi u boxeve za bruto, neto. jedino jos moras napraviti da se zbroji sve to.
__________________
noobinator je offline   Reply With Quote
Staro 11.02.2009., 22:04   #13
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
Private Sub Command1_Click() 'BUTTON
    Dim hdcp As Integer
hdcp = CInt(Combo1.Text)   '
ucitaj sta pise u combo1 tjpadajuci izbornik
For 1 To 18
b
(i) = bruto(p(i), r(i))
n(i) = neto(ip(i), r(i), hdcp)
Next i
End Sub 
Ja sam ovaj zadnji dio ovako stavio, tu sam dodao button i sad očitava grešku.. neznam di da drugdje stavim button, i di ide ostatak koda, normalno u general?-->
PHP kod:
Private Sub Command1_Click() 'BUTTON
    Dim hdcp As Integer
hdcp = CInt(Combo1.Text)   '
ucitaj sta pise u combo1 tjpadajuci izbornik
For 1 To 18
b
(i) = bruto(p(i), r(i))
n(i) = neto(ip(i), r(i), hdcp)
Next i
End Sub 
Ja sam ovaj zadnji dio ovako stavio, tu sam dodao button i sad očitava grešku.. neznam di da drugdje stavim button, i di ide ostatak koda, normalno u general?
malixx je offline   Reply With Quote
Staro 11.02.2009., 23:57   #14
noobinator
Premium
Moj komp
 
noobinator's Avatar
 
Datum registracije: Mar 2008
Lokacija: zg
Postovi: 120
eh, naso gresku:

n(i) = neto(i, p(i), r(i), hdcp)

treba maknut ovaj prvi i poslje neto.
znaci ovak:

n(i) = neto(p(i), r(i), hdcp)
__________________
noobinator je offline   Reply With Quote
Staro 05.12.2014., 22:01   #15
malixx
Premium
 
Datum registracije: Feb 2009
Lokacija: Zagreb
Postovi: 76
Pomoć

Pozdrav,

trebam provjeriti brojeve koji se pokazuju u jednom labelu (Label1).
Da li postoji nacin da se skrati ovaj kod ispd? Jer imam puno brojeva koji nejdu po redu.

Code:
If Label1 = "1" Or Label1 = "3" Or Label1 = "6" Label1 = "10" Then
Label2.Caption = "R"
end if
Npr. da bude If Label1 = 1,3,7,20,47,80 then ?

Možda sa nekom petljom, ili vidio sam slucajeve sa "Case". Case napravim,
ali onda taj case opet ne mogu provjerit kroz if/else... Ima ko ideju?

Zadnje izmijenjeno od: malixx. 11.12.2014. u 17:56.
malixx je offline   Reply With Quote
Oglas
 
Oglas
Oglasni prostor

Odgovori


Uređivanje

Pravila postanja
Vi ne možete otvarati nove teme
Vi ne možete pisati odgovore
Vi ne možete uploadati priloge
Vi ne možete uređivati svoje poruke

BB code je Uključeno
Smajlići su Uključeno
[IMG] kod je Uključeno
HTML je Isključeno

Idi na