lamont Posted July 14, 2014 Share Posted July 14, 2014 arkadaşlar C# textbox ları boş geçtiginde hata mesajı ile boş geçmezsin hatasını yaparken hata alıyorum sorun nedir if (textbox1.text ="") messagebox.show ('textbox boş geçemezsiniz);' aşagıdaki hatayı alıyorum Cannot implicitly convert type 'string' to 'bool' Quote Link to comment Share on other sites More sharing options...
DivaneTR Posted July 14, 2014 Share Posted July 14, 2014 textbox1.text.ToString bu şekilde dene. Quote Link to comment Share on other sites More sharing options...
KintaRo Posted July 14, 2014 Share Posted July 14, 2014 söz dizimi yanlış olmuş if (textbox1.Text == "") { // boşsa çalışacak kodlar } else { // boş değilse çalışacak kodlar } Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 14, 2014 Editor Share Posted July 14, 2014 messagebox.show ((textbox.Text.Lengt > 0) ? "Boş değil" : "Boş"); Quote Link to comment Share on other sites More sharing options...
alparslan Posted July 14, 2014 Share Posted July 14, 2014 (edited) Tekeşittir koymuşsun o sıkıntı olmuş. iki tane eşittir koyucaksın if sorgusu içine private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") MessageBox.Show("Boş olmasın"); } Edited July 14, 2014 by alparslan Quote Link to comment Share on other sites More sharing options...
lamont Posted July 14, 2014 Author Share Posted July 14, 2014 söz dizimi yanlış olmuş if (textbox1.Text == "") { // boşsa çalışacak kodlar } else { // boş değilse çalışacak kodlar } kintaro süs parentezin dışında tanımlamışsın if döngüsünü ama alparslan kardeşin yaptı şekilde oldu parantezin dışında tanımladın ? Quote Link to comment Share on other sites More sharing options...
alparslan Posted July 14, 2014 Share Posted July 14, 2014 kintaro süs parentezin dışında tanımlamışsın if döngüsünü ama alparslan kardeşin yaptı şekilde oldu parantezin dışında tanımladın ? @kintaro sana direk if döngüsünü böyle yaz demiş butonun içine yazmamış zaten o. Benim yaptığım işini görür Quote Link to comment Share on other sites More sharing options...
KintaRo Posted July 14, 2014 Share Posted July 14, 2014 alparslan ile benim yazdığım kodun bir farkı yok. if koşulunu parantezli de parantezsiz de kullanabilirsin. alparslan farklı bir şey yazmamış yani. sadece ben textBox1 yerine textbox1 yazdım. Projeyi açıp yazmadım. Visual Studio case sensitive olduğu için benim kodu kopyala yapıştır yaparsan hata alırsın. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.