TextBox boş iken uyarı vermek

Katılım
5 Aralık 2005
Mesajlar
83
Merhaba,

Þuan küçük bir form var elimde ve o formda doldurulması zorunlu olan textboxlar var.Kullanıcı o texboxları doldurmadan command buttonuna bastığında bir msgbox ile textboxların doldurulmasını nasıl sağlayabilirim?

Biliyorum aslında kolay bişey ama yapamadım napıyım !!!
 

zafer

Super Moderator
Yönetici
Katılım
8 Mart 2005
Mesajlar
3,288
Excel Vers. ve Dili
OFFICE 2003 TÜRKÇE
OFFICE 2010 TÜRKÇE
Merhaba

Zorunlu olanlar hangileri textbox1 ,2 3
1 den 10'kadar bunları yazabilirmisiniz.
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,245
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Selamlar,

Aşağıdaki kod ile form üzerindeki 6 adet textboxı döngü ile kontrol edebilirsiniz. (6 rakamını artırabilirsiniz.)

Private Sub CommandButton1_Click()
For X = 1 To 6
If Controls("TextBox" & X).Value = Empty Then
MsgBox ("Kayıt işlemi için gerekli tüm bölümlere veri girmelisiniz." _
& Chr(10) & "Lütfen boş bıraktığınız bölümleri doldurunuz."), vbExclamation, "DİKKAT !"
Controls("TextBox" & X).SetFocus
Exit Sub
End If
Next X
'Sizin kodlarınız...
 
Katılım
5 Aralık 2005
Mesajlar
83
combobox

Tamam kodları kendiminkine çevirdim yaptım.Teşekkür ederim.

Yalnız bi sorun daha var.Combobox ile exceldeki verileri form üzerinde nasıl gösterebilirm?Size kodları gönderiyorum.Yani bu form hakkında yaptıklarımı gönderiyorum.Umarım yardımcı olursunuz.Burda combobox 1 ile exceldeki verileri form üzerine çekmesini sağlamam gerekiyor ama olmadı.

Private Sub ComboBox1_Change()
Dim acount As Integer
Dim x As String
acount = 2
For i = 2 To 10000
If Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Then
acount = acount + 1
End If
Next i

x = ComboBox1.Text

For i = 1 To acount

If Cells(i, 12) = x Then
ComboBox1.Text = Cells(i, 12)
TextBox1.Text = Cells(i, 1)
TextBox3.Text = Cells(i, 3)
ComboBox2.Text = Cells(i, 4)
ComboBox3.Text = Cells(i, 10)
TextBox2.Text = Cells(i, 2)
TextBox9.Text = Cells(i, 9)
TextBox5.Text = Cells(i, 5)
TextBox6.Text = Cells(i, 6)
TextBox8.Text = Cells(i, 8)
TextBox7.Text = Cells(i, 7)
TextBox11.Text = Cells(i, 11)






End If
Next i

End Sub



Private Sub CommandButton1_Click()
Dim acount As Integer
acount = 2
For i = 2 To 10000
If Cells(i, 2) <> "" Or Cells(i, 3) <> "" Or Cells(i, 4) <> "" Then
acount = i + 1
End If
Next i

Cells(acount, 1) = TextBox1.Text
Cells(acount, 2) = TextBox2.Text
Cells(acount, 3) = TextBox3.Text
Cells(acount, 4) = ComboBox1
Cells(acount, 5) = TextBox5.Text
Cells(acount, 6) = TextBox6.Text
Cells(acount, 7) = TextBox7.Text
Cells(acount, 8) = TextBox8.Text
Cells(acount, 9) = TextBox9.Text
Cells(acount, 10) = ComboBox3
Cells(acount, 11) = TextBox11.Text
Cells(acount, 12) = ComboBox2


TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox11.Text = ""



End Sub

Private Sub CommandButton2_Click()
End
End Sub

Private Sub TextBox2_Change()
Dim i As String
Dim myArray() As String
Dim month(12)
Dim str As String
Dim count As Integer
month(0) = "Jan"
month(1) = "Feb"
month(2) = "Mar"
month(3) = "Apr"
month(4) = "May"
month(5) = "Jun"
month(6) = "Jul"
month(7) = "Aug"
month(8) = "Sep"
month(9) = "Oct"
month(10) = "Nov"
month(11) = "Dec"
i = TextBox2.Text
count = Len(i)

If off = 1 Then
count = count - 2
off = 0
End If
If count = 10 Then
myArray() = Split(i, ".")

str = myArray(0) + "-" + month(myArray(1) - 1) + "-" + myArray(2)
TextBox10.Text = str
off = 1

End If
End Sub

Private Sub TextBox3_Change()
Dim i As String
Dim myArray() As String
Dim month(12)
Dim str As String
Dim count As Integer
month(0) = "Jan"
month(1) = "Feb"
month(2) = "Mar"
month(3) = "Apr"
month(4) = "May"
month(5) = "Jun"
month(6) = "Jul"
month(7) = "Aug"
month(8) = "Sep"
month(9) = "Oct"
month(10) = "Nov"
month(11) = "Dec"
i = TextBox3.Text
count = Len(i)

If off = 1 Then
count = count - 2
off = 0
End If
If count = 10 Then
myArray() = Split(i, ".")

str = myArray(0) + "-" + month(myArray(1) - 1) + "-" + myArray(2)
TextBox10.Text = str
off = 1

End If
End Sub

Private Sub TextBox5_Change()
Dim i As String
Dim myArray() As String
Dim month(12)
Dim str As String
Dim count As Integer
month(0) = "Jan"
month(1) = "Feb"
month(2) = "Mar"
month(3) = "Apr"
month(4) = "May"
month(5) = "Jun"
month(6) = "Jul"
month(7) = "Aug"
month(8) = "Sep"
month(9) = "Oct"
month(10) = "Nov"
month(11) = "Dec"
i = TextBox5.Text
count = Len(i)

If off = 1 Then
count = count - 2
off = 0
End If
If count = 10 Then
myArray() = Split(i, ".")

str = myArray(0) + "-" + month(myArray(1) - 1) + "-" + myArray(2)
TextBox10.Text = str
off = 1

End If
End Sub

Private Sub TextBox6_Change()
Dim i As String
Dim myArray() As String
Dim month(12)
Dim str As String
Dim count As Integer
month(0) = "Jan"
month(1) = "Feb"
month(2) = "Mar"
month(3) = "Apr"
month(4) = "May"
month(5) = "Jun"
month(6) = "Jul"
month(7) = "Aug"
month(8) = "Sep"
month(9) = "Oct"
month(10) = "Nov"
month(11) = "Dec"
i = TextBox6.Text
count = Len(i)

If off = 1 Then
count = count - 2
off = 0
End If
If count = 10 Then
myArray() = Split(i, ".")

str = myArray(0) + "-" + month(myArray(1) - 1) + "-" + myArray(2)
TextBox10.Text = str
off = 1

End If
End Sub

Private Sub UserForm_Initialize()

ComboBox1.AddItem "ATG"
ComboBox1.AddItem "ELDG"
ComboBox1.AddItem "SMB"
ComboBox1.AddItem "SMYG"
ComboBox1.AddItem "TDG"

ComboBox2.AddItem "Bülent Ã?zge"
ComboBox2.AddItem "Fatih Ã?zakdağ"
ComboBox2.AddItem "A.Egemen Yılmaz"
ComboBox2.AddItem "Alp Rıza Ünal"
ComboBox2.AddItem "Ã?zlem Dönmez Dura"
ComboBox2.AddItem "Volkan Becit"
ComboBox2.AddItem "Zekiye Buz"
ComboBox2.AddItem "Mihrimah-ASE"
ComboBox2.AddItem "Emel-ASE"
ComboBox2.AddItem "ASE-Alan"
ComboBox2.AddItem "Bob Clark"
ComboBox2.AddItem "Grey Giles"
ComboBox2.AddItem "Ã?mer Ertekin-Temel Taş"
ComboBox2.AddItem "Ã?mer Ertekin"
ComboBox2.AddItem "ASE-Tuaf"
ComboBox2.AddItem "Gül Çolak"
ComboBox2.AddItem "Gül Çolak-Mustafa Aydın-Ali Kasapoğlu"
ComboBox2.AddItem "Mustafa Aydın"
ComboBox2.AddItem "Alper Þen"
ComboBox2.AddItem "Mete Kalaycıoğlu"
ComboBox2.AddItem "Halil Kızılca"
ComboBox2.AddItem "Taner Tımış"

ComboBox3.AddItem "Open"
ComboBox3.AddItem "Closed"

End Sub
 
Üst