• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Textboxta yazılan rakamlar buton olmadan sonucu hesaplasın

Katılım
10 Mart 2011
Mesajlar
2
Excel Vers. ve Dili
2007 türkçe
basit bir hesap makinesi yapmak istiyorum sadece 4 işlem yapacak, OptionButton dan 4 işlemden birini seçip 1.sayıya rakam 2.sayıya rakam yazınca sonuç kısmını kendi otomatik getirecek, çok araştırdım bulamadım yardım istiyorum şimdiden tşk.
 

Ekli dosyalar

yanıt

Kod:
Private Sub OptionButton1_Click()
TextBox3 = Val(TextBox1) + Val(TextBox2)
End Sub
Private Sub OptionButton2_Click()
TextBox3 = Val(TextBox1) - Val(TextBox2)
End Sub
Private Sub OptionButton3_Click()
TextBox3 = Val(TextBox1) / Val(TextBox2)
End Sub
Private Sub OptionButton4_Click()
TextBox3 = Val(TextBox1) * Val(TextBox2)
End Sub
 
Alternatif olarak ekliyorum.
not: bu uygulama tam sayılarda doğru sonucu verir küsürlü sayılarda hatalı sonuç verir

Private Sub OptionButton1_Click()
TextBox1_Change
End Sub
Private Sub OptionButton2_Click()
TextBox1_Change
End Sub
Private Sub OptionButton3_Click()
TextBox1_Change
End Sub
Private Sub OptionButton4_Click()
TextBox1_Change
End Sub
Private Sub TextBox1_Change()
If OptionButton1.Value = True Then
TextBox3.Text = Val(TextBox1.Value) + Val(TextBox2.Value)
ElseIf OptionButton2.Value = True Then
TextBox3.Text = Val(TextBox1.Value) - Val(TextBox2.Value)
ElseIf OptionButton3.Value = True Then
TextBox3.Text = Val(TextBox1.Value) / Val(TextBox2.Value)
ElseIf OptionButton4.Value = True Then
TextBox3.Text = Val(TextBox1.Value) * Val(TextBox2.Value)
End If
End Sub
Private Sub TextBox2_Change()
If OptionButton1.Value = True Then
TextBox3.Text = Val(TextBox1.Value) + Val(TextBox2.Value)
ElseIf OptionButton2.Value = True Then
TextBox3.Text = Val(TextBox1.Value) - Val(TextBox2.Value)
ElseIf OptionButton3.Value = True Then
TextBox3.Text = Val(TextBox1.Value) / Val(TextBox2.Value)
ElseIf OptionButton4.Value = True Then
TextBox3.Text = Val(TextBox1.Value) * Val(TextBox2.Value)
End If
End Sub
 
Halit Bey, Ziya bey sizlere çok teşekkür ederim optionbuttonların ve sayıların textboxlarda kullanımını sayenizde öğrendim bu bilgiler benim için çok önemli ve kalıcı bir eser niteliğinde, ilerideki çalışmalarımın temelini siz attınız çok sağolun
 
Geri
Üst