![]() |
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. |
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. |
http://www.zaslike.com/files/kpqk3ca...rggm_thumb.jpg
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š. |
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)) :) |
Code:
Private Sub Command1_Click() |
malo je to puno koda :D
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:
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??? |
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 |
imas neku formulu po kojoj se racuna to?
daj napisi ju, po necem si radil valjda. izgubim se u kodu Oo. |
Citiraj:
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:
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:
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 |
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:
|
E ajde reci jel ovako misliš za sve ??
http://www.zaslike.com/files/qaxezvu...b2v9_thumb.jpghttp://www.zaslike.com/files/qs3xqw5...bj9v_thumb.jpghttp://www.zaslike.com/files/gu3wkyf...j205_thumb.jpg A kaj s boxevima: "rout,bout,nout,rin,bin,nin,rtot,btot,ntot" ?? . |
mislim da bi to bilo to (provjeri ipak!):
PHP kod:
rezultat se spremi u boxeve za bruto, neto. jedino jos moras napraviti da se zbroji sve to. |
PHP kod:
|
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) |
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 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? |
Sva vremena su GMT +2. Sada je 14:31. |
Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 1999-2024 PC Ekspert - Sva prava pridržana ISSN 1334-2940
Ad Management by RedTyger