• DİKKAT

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

OptionButton seçilmemesi halinde UYARI vermesi

Katılım
24 Mayıs 2005
Mesajlar
462
Excel Vers. ve Dili
Excel 2003 Türkçe
Selam Arkadaşlar,
If TextBox1 = "" Or TextBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Or TextBox6 = "" Or OptionButton1.Value=False Or OptionButton1.Value=False Then
MsgBox "LÜTFEN VERİ BİLGİLERİNİ GİRİNİZ!", 16, "DİKKAT"
TextBox1.SetFocus
Exit Sub
End If
Yukarıdaki örnek koda göre,
UserForm1 üzerinde bulunan 5 adet OptionButton ların herhangi biririnin seçilmemiş olması durumunda MsgBox "LÜTFEN VERİ BİLGİLERİNİ GİRİNİZ!", 16, "DİKKAT" uyarısının ekrana gelmesini istiyorum.

OptionButton1.Value=False olarak yazıyorum ancak bir türlü yapamadım. yardımcı olursanız sevinirim. Selamlar. :hey:
 
Birde aşağıdaki şekilde deneyin.

[vb:1:1ec8bbc45c]For a = 1 To 5
If Controls("optionbutton" & a).Value = True Then Exit Sub
Next
MsgBox "LÜTFEN VERİ BİLGİLERİNİ GİRİNİZ!", 16, "DİKKAT"[/vb:1:1ec8bbc45c]
 
Sayın Leventm, Run-Time Error hatası veriyor. Ayrıca ben diğer TextBox`larla birlikte kontrol etmesini istiyorum. Yani TextBox lardan birine veri girilmez ve OptionButtonlardan (5 adet) herhangibiri seçilmez ise mesaj gelsin istiyorum. Teşekkürler.
 
Aşağıdaki şekilde deneyin.

[vb:1:5936f82559]For a = 1 To 5
If Controls("optionbutton" & a).Value = True Then goto 10
Next
MsgBox "LÜTFEN VERİ BİLGİLERİNİ GİRİNİZ!", 16, "DİKKAT"
10 If TextBox1 = "" Or TextBox2 = "" Or TextBox3 = "" Or TextBox4 = "" Or TextBox6 = "" Or Then
MsgBox "LÜTFEN VERİ BİLGİLERİNİ GİRİNİZ!", 16, "DİKKAT"
TextBox1.SetFocus
Exit Sub
End If





[/vb:1:5936f82559]
 
Fantezi,

[vb:1:f70f6a6f71]Dim c As Control
For Each c In Controls
If (TypeName(c) = "TextBox" And c.Value = "") Or (TypeName(c) = "optionbutton" = 0 And c.Value = False) Then MsgBox ("eksik bilgi"): c.SetFocus: Exit For
Next[/vb:1:f70f6a6f71]
 
"Could not find the specifild object" hatası veriyor.
 
Bir seyi atliyoruz sanirim.

eger ayri konteynırlar içinde değilse, option butonlari hepsinin seçili olmasina imkan yok.

ek;
Checkbox demek istiyor olmayasiniz.
 
Sayın Leventm ve Alpen, ilginize teşekkür ederim.
Sorunumu çözdüm aşağıdaki şekilde kodlarımı değiştirdim oldu. Sağlıkla kalın.

If TextBox29 = "" Or TextBox31 = "" Or TextBox34 = "" Or TextBox35 = "" Or TextBox36 = "" Or TextBox37 = "" Or TextBox38 = "" Or (OptionButton5 = False) = (OptionButton4 = False) = (OptionButton3 = False) = (OptionButton2 = False) = (OptionButton1 = False) Then
MsgBox "LÜTFEN VERİ BİLGİLERİNİ GİRİNİZ!", 16, "DİKKAT"
TextBox29.SetFocus
Exit Sub
End If
 
Geri
Üst