C#EOEfe Onah Ojobo11yAsked Jun 25, 2015, 3:28 AM EDT9 answersShareLinkedInXCopy linkSavehow do you check if your comboBox and textbox is empty,so it can display the message box
C#EOEfe Onah Ojobo11yAsked Jun 25, 2015, 3:28 AM EDT9 answersShareLinkedInXCopy linkSavehow do you check if your comboBox and textbox is empty,so it can display the message box
Rajeesh MenothRank #118 · 18.4K reputation11y agoPosted Jun 25, 2015, 3:43 AM EDT+1Hi, if (string.IsNullOrWhiteSpace(TextBox.Text) && string.IsNullOrEmpty(comboBox1.Text)) { // Message box}+1Bhushan BhasmeRank #2,348 · 604 reputation11y agoPosted Jun 25, 2015, 3:41 AM EDT0 if(comboBox1.Items.Count()==0 ){//do somethingMessageBox.show("Please Add Some items To Combobox");} if(String.IsNullOrEmpty(txtSample.text)){ //do something MessageBox.show("Please Enter Some Text"); } Hop This Will Help You0RKRavi KumarRank #2,085 · 690 reputation11y agoPosted Jun 25, 2015, 3:56 AM EDT0 hi checkif(!string.IsNullOrEmpty(textbox1.text)){ } if(!string.IsNullOrEmpty(combobox.text)){ }0Jaipal ReddyRank #588 · 4.1K reputation11y agoPosted Jun 25, 2015, 4:12 AM EDT0if (string.IsNullOrWhiteSpace(TextBox.Text){MessageBox.show("--Msg--");}if(string.IsNullOrEmpty(comboBox1.Text)){MessageBox.show("--Msg--");}0EOEfe Onah Ojobo32 reputation11y agoPosted Jun 25, 2015, 4:46 AM EDT0tried it error value cannot be null0EOEfe Onah Ojobo32 reputation11y agoPosted Jun 25, 2015, 4:47 AM EDT0tried it error value cannot be null (comboBox)0Bhushan BhasmeRank #2,348 · 604 reputation11y agoPosted Jun 25, 2015, 7:00 PM EDT0YOu can Place It Into try and catch block....and in catch block you can have message box0Jignesh TrivediRank #16 · 50.3K reputation11y agoPosted Jun 25, 2015, 8:02 PM EDT0hi, what you mean combo box is empty? combo does not contain value or not selected any value? 0Bharathi RajaRank #1,778 · 842 reputation8y agoPosted Jan 31, 2018, 11:53 PM EST0if (comboBox1.SelectedIndex==-1 || textbox1.text=="") { MessageBox.Show("You must select a conversion type", "Error"); } else { MessageBox.Show("Selected"); } 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bhushan BhasmeRank #2,348 · 604 reputation11y agoPosted Jun 25, 2015, 3:41 AM EDT0 if(comboBox1.Items.Count()==0 ){//do somethingMessageBox.show("Please Add Some items To Combobox");} if(String.IsNullOrEmpty(txtSample.text)){ //do something MessageBox.show("Please Enter Some Text"); } Hop This Will Help You0
RKRavi KumarRank #2,085 · 690 reputation11y agoPosted Jun 25, 2015, 3:56 AM EDT0 hi checkif(!string.IsNullOrEmpty(textbox1.text)){ } if(!string.IsNullOrEmpty(combobox.text)){ }0Jaipal ReddyRank #588 · 4.1K reputation11y agoPosted Jun 25, 2015, 4:12 AM EDT0if (string.IsNullOrWhiteSpace(TextBox.Text){MessageBox.show("--Msg--");}if(string.IsNullOrEmpty(comboBox1.Text)){MessageBox.show("--Msg--");}0EOEfe Onah Ojobo32 reputation11y agoPosted Jun 25, 2015, 4:46 AM EDT0tried it error value cannot be null0EOEfe Onah Ojobo32 reputation11y agoPosted Jun 25, 2015, 4:47 AM EDT0tried it error value cannot be null (comboBox)0Bhushan BhasmeRank #2,348 · 604 reputation11y agoPosted Jun 25, 2015, 7:00 PM EDT0YOu can Place It Into try and catch block....and in catch block you can have message box0Jignesh TrivediRank #16 · 50.3K reputation11y agoPosted Jun 25, 2015, 8:02 PM EDT0hi, what you mean combo box is empty? combo does not contain value or not selected any value? 0Bharathi RajaRank #1,778 · 842 reputation8y agoPosted Jan 31, 2018, 11:53 PM EST0if (comboBox1.SelectedIndex==-1 || textbox1.text=="") { MessageBox.Show("You must select a conversion type", "Error"); } else { MessageBox.Show("Selected"); } 0
Jaipal ReddyRank #588 · 4.1K reputation11y agoPosted Jun 25, 2015, 4:12 AM EDT0if (string.IsNullOrWhiteSpace(TextBox.Text){MessageBox.show("--Msg--");}if(string.IsNullOrEmpty(comboBox1.Text)){MessageBox.show("--Msg--");}0
EOEfe Onah Ojobo32 reputation11y agoPosted Jun 25, 2015, 4:46 AM EDT0tried it error value cannot be null0
EOEfe Onah Ojobo32 reputation11y agoPosted Jun 25, 2015, 4:47 AM EDT0tried it error value cannot be null (comboBox)0
Bhushan BhasmeRank #2,348 · 604 reputation11y agoPosted Jun 25, 2015, 7:00 PM EDT0YOu can Place It Into try and catch block....and in catch block you can have message box0
Jignesh TrivediRank #16 · 50.3K reputation11y agoPosted Jun 25, 2015, 8:02 PM EDT0hi, what you mean combo box is empty? combo does not contain value or not selected any value? 0
Bharathi RajaRank #1,778 · 842 reputation8y agoPosted Jan 31, 2018, 11:53 PM EST0if (comboBox1.SelectedIndex==-1 || textbox1.text=="") { MessageBox.Show("You must select a conversion type", "Error"); } else { MessageBox.Show("Selected"); } 0
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 25, 2015, 3:43 AM EDT
Bhushan BhasmeRank #2,348 · 604 reputationPosted Jun 25, 2015, 3:41 AM EDT
Ravi KumarRank #2,085 · 690 reputationPosted Jun 25, 2015, 3:56 AM EDT
Jaipal ReddyRank #588 · 4.1K reputationPosted Jun 25, 2015, 4:12 AM EDT
{
MessageBox.show("--Msg--");
}
if(string.IsNullOrEmpty(comboBox1.Text))
{
MessageBox.show("--Msg--");
}
Efe Onah Ojobo32 reputationPosted Jun 25, 2015, 4:46 AM EDT
Efe Onah Ojobo32 reputationPosted Jun 25, 2015, 4:47 AM EDT
Bhushan BhasmeRank #2,348 · 604 reputationPosted Jun 25, 2015, 7:00 PM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 25, 2015, 8:02 PM EDT
Bharathi RajaRank #1,778 · 842 reputationPosted Jan 31, 2018, 11:53 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts