IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

 Kayıt ol  Topluluk
Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 21 Temmuz 2008, 19:11   #1
Çevrimiçi
Yardımcı Admin
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Ortalama Hesaplama




PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
'Projeye Eklenecekler
'
txtScores(0) : Edit
'txtScores(1) : Edit
'
txtScores(2) : Edit
'txtScores(3) : Edit
'
txtScores(4) : Edit
'txtAnswer : Edit
'
cmdCalculate CommandButton
'cmdClear : CommandButton
'
cmdExit CommandButton

'
Calculate average scores
'
'
For the purpose of this demo I've used text boxes.
'
Ideally one would use labels rather than text boxes
'for displaying scores. That way we don't let the
'user cheat changing scores ;-)

'  
:-: Give credit where credit is due :-:

'I read an answer to a question in one of the vb
'
news groups titled "Sums in VB3" by Markus
'
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
 and ended up trying it myself
'
So thanks go to Markus wherever you are.

'Also used in this demo is some code by Adnan Hasanovic
'
which can be found at:
'
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
style="color: #0000BB">Nice 3D Effect
, try it!

'Email: 
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
.za


Option Explicit

Dim counter As Integer
Dim sum As Integer

Private Sub cmdCalculate_Click()
    Dim i As Integer
    Dim average As String

    '
Set counter to 0
    counter 
0

    
'Set sum to 0
    sum = 0

    '
Count number of text boxes that have values
    
'in them and sum them. If any text box has no
    '
value (empty) then the counter excludes that
    
'box in the final equation
     For i = 0 To 4
        If txtScores(i) <> "" And Not IsNumeric(txtScores(i)) Then
            MsgBox "All values must be numeric!"
            Exit Sub
        End If
    Next i
    
    For i = 0 To 4
        If txtScores(i) <> "" Then
            sum = sum + txtScores(i)
            counter = counter + 1
        End If
    Next i

    '
Straight forward math done here.
    If 
counter 0 Then average sum counter

    txtAnswer
.Text average
End Sub

Private Sub cmdClear_Click()

    
'Clear all text boxes.
    Dim i As Integer

    For i = 0 To 4
        txtScores(i).Text = ""
    Next i

    txtAnswer.Text = ""
End Sub

Private Sub cmdExit_Click()
    Set frmAverage = Nothing
    Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set frmAverage = Nothing
End Sub

Sub PaintForm3D(frm As Form)
    ' 
This Sub draws lines around the Form to make it 3d

    
' white, upper - horizontal
    frm.Line (0, 0)-(frm.ScaleWidth, 0), &HFFFFFF, BF
    ' 
whiteleft vertical
    frm
.Line (00)-(0frm.ScaleHeight), &HFFFFFFBF
    
' darkgrey, right - vertical
    frm.Line (frm.ScaleWidth - 15, 0)-(frm.ScaleWidth - 15, _
            frm.Height), &H808080, BF
    ' 
darkgreylower horizontal
    frm
.Line (0frm.ScaleHeight 15)-(frm.ScaleWidth_
            frm
.ScaleHeight 15), &H808080BF

End Sub

Private Sub Form_Load()
    
Me.AutoRedraw True
    PaintForm3D Me
End Sub 

Alıntıdır

__________________
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları sohbet odaları Benimmekan Mobil Sohbet
Cevapla

Etiketler
hesaplama, ortalama


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Excel Ortalama Hesaplama Deep Programlama 0 28 Eylül 2014 00:40
Logoyu Ortalama SHYSTER vBulletin Sorunları ve Çözümleri 0 09 Aralık 2005 10:31