Click here to Skip to main content
15,357,086 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Windows application not responding after 30 minutes Pin
sujithkumarsl3-Oct-12 4:51
Membersujithkumarsl3-Oct-12 4:51 
AnswerRe: C# Windows application not responding after 30 minutes Pin
DaveyM693-Oct-12 4:21
professionalDaveyM693-Oct-12 4:21 
GeneralRe: C# Windows application not responding after 30 minutes Pin
sujithkumarsl3-Oct-12 4:41
Membersujithkumarsl3-Oct-12 4:41 
GeneralRe: C# Windows application not responding after 30 minutes Pin
DaveyM694-Oct-12 0:34
professionalDaveyM694-Oct-12 0:34 
GeneralRe: C# Windows application not responding after 30 minutes Pin
sujithkumarsl4-Oct-12 10:17
Membersujithkumarsl4-Oct-12 10:17 
QuestionTextbox validation c# help Pin
User 94041062-Oct-12 8:57
MemberUser 94041062-Oct-12 8:57 
AnswerRe: Textbox validation c# help Pin
Matt T Heffron2-Oct-12 10:38
professionalMatt T Heffron2-Oct-12 10:38 
AnswerRe: Textbox validation c# help Pin
Smart Arab2-Oct-12 11:17
MemberSmart Arab2-Oct-12 11:17 
This code well search for all text box in your form and validated it, and it will be better If you Use Tag for Description of Textbox so the user know what he is missing, Plus you avoid typing in the MessageBox something like "No Name" , No Phone" , etc ...

More Over you can tell which TextBox in the form is needed to be validate by checking that Tag if it's Empty or not.


C#
private void CheckTextBox()
       {
           TxtName.Tag = "First Name";
           TxtPhone.Tag = "Phone Number";

           foreach (Control control in this.Controls)
           {
               if (control.GetType().Equals(typeof(TextBox)))
               {
                   if (ValidateText(control.Text))
                   {
                       MessageBox.Show(control.Tag.ToString());
                       MessageBox.Show(control.Name);
                   }

               }
           }
       }

       private bool ValidateText(string text)
       {
           return text.Equals(string.Empty);
       }

P.S :
You can assign the Tag for TextBox by properties Windows during design time.
GeneralRe: Textbox validation c# help Pin
User 94041062-Oct-12 11:27
MemberUser 94041062-Oct-12 11:27 
GeneralRe: Textbox validation c# help Pin
User 94041068-Oct-12 3:37
MemberUser 94041068-Oct-12 3:37 
QuestionMonitoring file changes and changing data within the file... Pin
JD862-Oct-12 8:31
MemberJD862-Oct-12 8:31 
AnswerRe: Monitoring file changes and changing data within the file... Pin
Smart Arab2-Oct-12 11:22
MemberSmart Arab2-Oct-12 11:22 
GeneralRe: Monitoring file changes and changing data within the file... Pin
Pete O'Hanlon3-Oct-12 2:03
mvaPete O'Hanlon3-Oct-12 2:03 
AnswerRe: Monitoring file changes and changing data within the file... Pin
Eddy Vluggen3-Oct-12 1:39
professionalEddy Vluggen3-Oct-12 1:39 
AnswerRe: Monitoring file changes and changing data within the file... Pin
Pete O'Hanlon3-Oct-12 2:26
mvaPete O'Hanlon3-Oct-12 2:26 
GeneralRe: Monitoring file changes and changing data within the file... Pin
Dave Kreskowiak3-Oct-12 5:33
mveDave Kreskowiak3-Oct-12 5:33 
GeneralRe: Monitoring file changes and changing data within the file... Pin
Pete O'Hanlon3-Oct-12 5:37
mvaPete O'Hanlon3-Oct-12 5:37 
GeneralRe: Monitoring file changes and changing data within the file... Pin
Dave Kreskowiak3-Oct-12 13:38
mveDave Kreskowiak3-Oct-12 13:38 
AnswerRe: Monitoring file changes and changing data within the file... Pin
BobJanova3-Oct-12 2:42
MemberBobJanova3-Oct-12 2:42 
GeneralRe: Monitoring file changes and changing data within the file... Pin
Pete O'Hanlon3-Oct-12 3:10
mvaPete O'Hanlon3-Oct-12 3:10 
GeneralRe: Monitoring file changes and changing data within the file... Pin
JD863-Oct-12 13:59
MemberJD863-Oct-12 13:59 
GeneralRe: Monitoring file changes and changing data within the file... Pin
JD8612-Oct-12 5:27
MemberJD8612-Oct-12 5:27 
QuestionC# setup and deploy project templates located at? Pin
dcof2-Oct-12 5:10
Memberdcof2-Oct-12 5:10 
AnswerRe: C# setup and deploy project templates located at? Pin
isenthil2-Oct-12 6:30
Memberisenthil2-Oct-12 6:30 
GeneralRe: C# setup and deploy project templates located at? Pin
dcof2-Oct-12 17:48
Memberdcof2-Oct-12 17:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.