Visual basic problem

Programi za crtanje shema i pločica, simuliranje el. sklopova, savjeti. Diskusija o ostalim programima vezanim za elektroniku.

Moderators: pedja089, stojke369, [eDo], trax

Post Reply
User avatar
Lukand
Odlično uznapredovao
Odlično uznapredovao
Posts: 652
Joined: 10-01-2006, 11:29
Location: Croatia
Contact:

Visual basic problem

Post by Lukand »

Imam jedan problem kod programiranja u visual basicu.

Kako da neki broj nakon djeljenja npr. 10/3 da ga zaokružim na 3,33 a ne kako mi on ispuše u onom label1 3,3333333333333
http://land1.blog.hr" onclick="window.open(this.href);return false;

I like software and hardware
My hobbies are PHP programmering, PCB creating and C++ 3D progrmming
http://www.speedtest.net/result/698562022.png" onclick="window.open(this.href);return false;
User avatar
sasa45
Odlično uznapredovao
Odlično uznapredovao
Posts: 518
Joined: 19-01-2007, 07:42
Location: Subotica - Srbija
Contact:

Re: Visual basic problem

Post by sasa45 »

samo da pitam sto ne pises u postojecu temu sto otvaras jos jednu....

http://www.elektronika.ba/forum/viewtop ... 9&start=30" onclick="window.open(this.href);return false;
User avatar
sasa45
Odlično uznapredovao
Odlično uznapredovao
Posts: 518
Joined: 19-01-2007, 07:42
Location: Subotica - Srbija
Contact:

Re: Visual basic problem

Post by sasa45 »

odgovoricu ovde ali molim admina da ovo spoji sa onom temom i da ovu izbrise

da testiras programcic potrebno ti je jedna forma
text1 - tu upisujes broj koji zelis da zaokruzjes
text2 - ovde upises na sta zelis da ga zaokruzis
label1 - tu ce ti posle klika na Command1 prikazati rezultat

Code: Select all

Function z(x As Single, u As Single) As Single
z = Int((x + u / 2) / u) * u
End Function

Private Sub Command1_Click()
Dim broj As Single
Dim decimala As Single
Dim rezultat As Single
broj = Val(Text1.Text)
decimala = Val(Text2.Text)
rezultat = z(broj, decimala)
Label1.Caption = rezultat
End Sub

neki od primera

Zaokruzi 1.215 na njablizih 0.25 od celog broja

1,25

Zaokruzi 1.38629436111989 na 4 decimale(0.0001)
1.3863

isti broj na 3 decimale:(0.001)
1.386

Zaokruzi broj 68241.3862 na najblizu stotinu(100)
68241.3862 = 68200
zubagonivincenta
Napredujem
Napredujem
Posts: 120
Joined: 14-06-2006, 18:03

Re: Visual basic problem

Post by zubagonivincenta »

Kako da neki broj nakon djeljenja npr. 10/3 da ga zaokružim na 3,33
ROUND(10/3;2)
User avatar
Lukand
Odlično uznapredovao
Odlično uznapredovao
Posts: 652
Joined: 10-01-2006, 11:29
Location: Croatia
Contact:

Re: Visual basic problem

Post by Lukand »

to je u visual basic-u ili samo u excelu
http://land1.blog.hr" onclick="window.open(this.href);return false;

I like software and hardware
My hobbies are PHP programmering, PCB creating and C++ 3D progrmming
http://www.speedtest.net/result/698562022.png" onclick="window.open(this.href);return false;
zubagonivincenta
Napredujem
Napredujem
Posts: 120
Joined: 14-06-2006, 18:03

Re: Visual basic problem

Post by zubagonivincenta »

I u Visual Basicu i u Excelu. Razlika može biti samo u separatoru ";" ili ",", što ovisi o verziji VB s kojom radiš.
Dakle ROUND(10/3;2) ili ROUND(10/3,2)
bciric
Napredujem
Napredujem
Posts: 115
Joined: 13-10-2008, 19:58

Re: Visual basic problem

Post by bciric »

pa pokusaj, ne mogu da verujem da te i to mrzi da pokusas.

koristi se zarez ,
User avatar
Lukand
Odlično uznapredovao
Odlično uznapredovao
Posts: 652
Joined: 10-01-2006, 11:29
Location: Croatia
Contact:

Re: Visual basic problem

Post by Lukand »

radi mi sa zarezom,

hvala svima na pomoći
http://land1.blog.hr" onclick="window.open(this.href);return false;

I like software and hardware
My hobbies are PHP programmering, PCB creating and C++ 3D progrmming
http://www.speedtest.net/result/698562022.png" onclick="window.open(this.href);return false;
Post Reply