Click here to Skip to main content
15,887,318 members
Home / Discussions / C#
   

C#

 
QuestionAdding datagridview columns Pin
michaelgr15-Jun-09 20:27
michaelgr15-Jun-09 20:27 
AnswerRe: Adding datagridview columns Pin
MickCurley5-Jun-09 21:28
MickCurley5-Jun-09 21:28 
GeneralRe: Adding datagridview columns Pin
michaelgr15-Jun-09 21:31
michaelgr15-Jun-09 21:31 
GeneralRe: Adding datagridview columns Pin
MickCurley5-Jun-09 21:39
MickCurley5-Jun-09 21:39 
GeneralRe: Adding datagridview columns Pin
michaelgr15-Jun-09 21:45
michaelgr15-Jun-09 21:45 
GeneralRe: Adding datagridview columns Pin
michaelgr15-Jun-09 21:49
michaelgr15-Jun-09 21:49 
GeneralRe: Adding datagridview columns Pin
MickCurley5-Jun-09 21:54
MickCurley5-Jun-09 21:54 
Questionmaking a scanner .. it skips alphanumerics.. where am i going wrong?? Pin
canatan5-Jun-09 18:14
canatan5-Jun-09 18:14 
okay i read the input from the text box as a char array.. then i've put if conditions that check for whitespaces, comments, strings, digits,
but it always skips which means that the comments then lie in the strings bit and so on...
please tell me where i went wrong here .
thankyou
#region Scanner
           for (int i = 0; i < readInput.Length; i++) // beginning to read char one by one
           {
               char x = readInput[i];
               #region Whitespace
               if (char.IsWhiteSpace(x)) //checking for whitespaces
               {
                   continue;
               }
               #endregion
               #region stringliteral
               else if (x == '"') //checking for " and proper"
               {
                   i++;
                   //x = readInput[i];
                   StringBuilder adder = new StringBuilder();
                   do
                   {x = readInput[i];
                       MessageBox.Show(x.ToString() + "testing");
                       adder.Append(x);                                //continuing till next " is found
                       i++;
                       if (i == readInput.Length)
                       {
                           MessageBox.Show("WRONG");
                           break;
                       }


                   } while (x != '"' && i < readInput.Length);
                   whole.Add(adder);

               }
               #endregion
               #region syntax
               else if (char.IsLetter(x) || x == '_' && x!='"') // checking for syntax
               {
                   StringBuilder adder = new StringBuilder();
                   do
                   {
                       x = readInput[i];
                       MessageBox.Show(x.ToString() + "Letter Only");
                       adder.Append(x);
                       i++;
                       if (i == readInput.Length)
                       {
                           break;
                       }


                   } while ((char.IsLetter(x) || x == '_' && x!='"') && i < readInput.Length);
                   whole.Add(adder);
               }
               #endregion
               #region digitliteral
               else if (char.IsDigit(x)) // checking for digits
               {
                   StringBuilder adder = new StringBuilder();
                   do
                   {x = readInput[i];
                       MessageBox.Show(x.ToString() + "Is Digit");
                       adder.Append(x);
                       i++;
                       if (i == readInput.Length)
                       {
                           break;
                       }


                   }
                   while (char.IsDigit(x) && i < readInput.Length);
                   whole.Add(adder);
               }
               #endregion
               #region comments
               else if (x == '$') //checking for comments
               {
                   i++;
                   x = readInput[i];
                   do
                   {
                       MessageBox.Show(x.ToString() + "testing comments"); //continuing till next " is found
                       i++;
                       if (i == readInput.Length)
                       {
                           MessageBox.Show("WRONG");
                           break;
                       }
                       x = readInput[i];

                   } while (x != '\n' && i < readInput.Length);

               }
               #endregion



           }
           #endregion

AnswerRe: making a scanner .. it skips alphanumerics.. where am i going wrong?? Pin
Christian Graus5-Jun-09 18:37
protectorChristian Graus5-Jun-09 18:37 
GeneralRe: making a scanner .. it skips alphanumerics.. where am i going wrong?? Pin
canatan5-Jun-09 20:33
canatan5-Jun-09 20:33 
GeneralRe: making a scanner .. it skips alphanumerics.. where am i going wrong?? Pin
Christian Graus5-Jun-09 20:48
protectorChristian Graus5-Jun-09 20:48 
GeneralRe: making a scanner .. it skips alphanumerics.. where am i going wrong?? Pin
canatan6-Jun-09 3:24
canatan6-Jun-09 3:24 
Questionhow to make Binary File in c# Pin
hamziak5-Jun-09 17:09
hamziak5-Jun-09 17:09 
AnswerRe: how to make Binary File in c# Pin
Christian Graus5-Jun-09 17:10
protectorChristian Graus5-Jun-09 17:10 
QuestionFlash movies without creating temporary files Pin
SSDream5-Jun-09 17:00
SSDream5-Jun-09 17:00 
AnswerRe: Flash movies without creating temporary files Pin
Christian Graus5-Jun-09 17:09
protectorChristian Graus5-Jun-09 17:09 
GeneralRe: Flash movies without creating temporary files Pin
SSDream6-Jun-09 18:26
SSDream6-Jun-09 18:26 
QuestionUse ActiveX without registration Pin
SSDream5-Jun-09 16:55
SSDream5-Jun-09 16:55 
AnswerRe: Use ActiveX without registration Pin
Christian Graus5-Jun-09 16:58
protectorChristian Graus5-Jun-09 16:58 
GeneralRe: Use ActiveX without registration Pin
SSDream6-Jun-09 18:43
SSDream6-Jun-09 18:43 
GeneralRe: Use ActiveX without registration Pin
Nishad S17-Jun-09 3:29
Nishad S17-Jun-09 3:29 
GeneralRe: Use ActiveX without registration Pin
SSDream17-Jun-09 16:32
SSDream17-Jun-09 16:32 
GeneralRe: Use ActiveX without registration Pin
Nishad S17-Jun-09 3:42
Nishad S17-Jun-09 3:42 
QuestionDLL protection Pin
SSDream5-Jun-09 16:53
SSDream5-Jun-09 16:53 
AnswerRe: DLL protection Pin
Christian Graus5-Jun-09 16:56
protectorChristian Graus5-Jun-09 16:56 

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.