Click here to Skip to main content
15,885,720 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# code is only inserting a few records. Pin
Norris Chappell25-Jun-15 15:49
Norris Chappell25-Jun-15 15:49 
GeneralRe: C# code is only inserting a few records. Pin
PIEBALDconsult29-Jun-15 15:36
mvePIEBALDconsult29-Jun-15 15:36 
QuestionFile permissions when writing a file to FTP server using FtpWebRequest Pin
DanDan_T25-Jun-15 6:47
DanDan_T25-Jun-15 6:47 
AnswerRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
Pete O'Hanlon25-Jun-15 9:28
mvePete O'Hanlon25-Jun-15 9:28 
GeneralRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
DanDan_T25-Jun-15 12:07
DanDan_T25-Jun-15 12:07 
GeneralRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
DanDan_T26-Jun-15 5:29
DanDan_T26-Jun-15 5:29 
AnswerRe: File permissions when writing a file to FTP server using FtpWebRequest Pin
Brisingr Aerowing25-Jun-15 19:48
professionalBrisingr Aerowing25-Jun-15 19:48 
QuestionHOw to solve input string was not in the correct format Pin
Siao Da25-Jun-15 4:50
Siao Da25-Jun-15 4:50 
There is only problem which is about the input string was not in the correct format. I use a textbox1 which is for me to type a number in the string format as I store the string in a variable knn. Then I try to convert it to Int32 and store it in another variable wup. However, after I tried to run the program, the error of input string popped up and I really run out of idea on what to do next.
C#
public void find() {
            int a = 0;
            int h = 0;
            Int32 t = 1;
            int f = 130;
            int d = 230;
            string knn;
            Int32 wup = 0;
            
            knn = textBox1.Text;
           
            wup = Convert.ToInt32(knn);
           //  wup = Convert.ToInt32(textBox5.Tag);
           // wup = Convert.ToInt64(knn);

           int [,] yes=new int[10,10];
           
            for(a=0 ;a<=7 ; a++) {
                for (h = 0; h <= 7; h++)
                {
                    if (a == 0)
                    {
                        if( t == wup)
                        {

System.Drawing.Graphics graphics = this.CreateGraphics();
System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                            graphics.DrawRectangle(System.Drawing.Pens.Red, square);
                            
textBox2.Text ="Index = "+ Convert.ToString(t);
                            textBox3.Text = "x = " + Convert.ToString(a);
                            textBox4.Text = "y = " + Convert.ToString(h);

                            //  textBox2.Text =textBox2.Text + Environment.NewLine + "Index= " + (Convert.ToString(t)); 
                            //  textBox3.Text = textBox3.Text +Environment.NewLine + "x= " + (Convert.ToString(a));
                            //  textBox4.Text = textBox4.Text +Environment.NewLine + "y= " + (Convert.ToString(h));
                        }
                       
                        f = f + 20;
                    }
                   
                  
                   if (a == 0 && h == 7)
                    {
                        f = 130;
                        d = d + 20;
                    }
                    if (a == 1)
                    {
                        if (t == wup)
                        {
                            System.Drawing.Graphics graphics = this.CreateGraphics();
                            System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                            graphics.DrawRectangle(System.Drawing.Pens.Red, square);

                             textBox2.Text ="Index = "+ Convert.ToString(t);
                            textBox3.Text = "x = " + Convert.ToString(a);
                            textBox4.Text = "y = " + Convert.ToString(h);
                           // textBox2.Text = textBox2.Text + Environment.NewLine + "Index= " + (Convert.ToString(t));
                           // textBox3.Text = textBox3.Text + Environment.NewLine + "x= " + (Convert.ToString(a));
                          //  textBox4.Text = textBox4.Text + Environment.NewLine + "y= " + (Convert.ToString(h));
                        }
                        f = f + 20;

                    }
                    if (a == 1 && h == 7)
                    {
                        f = 130;
                        d = d + 30;
                    }
                    if (a == 2)
                    {

                        if (t == wup)
                        {
                            System.Drawing.Graphics graphics = this.CreateGraphics();
                            System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                            graphics.DrawRectangle(System.Drawing.Pens.Red, square);
                             textBox2.Text ="Index"+ Convert.ToString(t);
                            textBox3.Text = "x" + Convert.ToString(a);
                            textBox4.Text = "y" + Convert.ToString(h);
                            //    textBox2.Text =textBox2.Text + Environment.NewLine + "Index= " + (Convert.ToString(t)); 
                            //   textBox3.Text = textBox3.Text +Environment.NewLine + "x= " + (Convert.ToString(a));
                            textBox4.Text = textBox4.Text + Environment.NewLine + "y= " + (Convert.ToString(h));
                        }
                        f = f + 20;

                    }
                    if (a == 2 && h == 7)
                    {
                        f = 130;
                        d = d + 30;
                    }
                    if (a == 3)
                    {

                        if (t == wup)
                        {
                            System.Drawing.Graphics graphics = this.CreateGraphics();
                            System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                            graphics.DrawRectangle(System.Drawing.Pens.Red, square);
                            textBox2.Text = "Index" + Convert.ToString(t);
                            textBox3.Text = "x" + Convert.ToString(a);
                            textBox4.Text = "y" + Convert.ToString(h);

                            //    textBox2.Text =textBox2.Text + Environment.NewLine + "Index= " + (Convert.ToString(t)); 
                            //    textBox3.Text = textBox3.Text +Environment.NewLine + "x= " + (Convert.ToString(a));
                            //    textBox4.Text = textBox4.Text +Environment.NewLine + "y= " + (Convert.ToString(h));
                        }
                        f = f + 20;

                    }
                    if (a == 3 && h == 7)
                    {
                        f = 130;
                        d = d + 30;
                    }
                    if (a == 4)
                    {

                          if (t == wup){

                        System.Drawing.Graphics graphics = this.CreateGraphics();
                        System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                        graphics.DrawRectangle(System.Drawing.Pens.Red, square);
                         textBox2.Text ="Index = "+ Convert.ToString(t);
                            textBox3.Text = "x = " + Convert.ToString(a);
                            textBox4.Text = "y = " + Convert.ToString(h);
                       // textBox2.Text =textBox2.Text + Environment.NewLine + "Index= " + (Convert.ToString(t)); 
                      //  textBox3.Text = textBox3.Text +Environment.NewLine + "x= " + (Convert.ToString(a));
                      //  textBox4.Text = textBox4.Text +Environment.NewLine + "y= " + (Convert.ToString(h));
                    }
                        f = f + 20;

                    }
                    if (a == 4 && h == 7)
                    {
                        f = 130;
                        d = d + 30;
                    }
                    if (a == 5)
                    {

                          if (t == wup){
                        System.Drawing.Graphics graphics = this.CreateGraphics();
                        System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                        graphics.DrawRectangle(System.Drawing.Pens.Red, square);
                              textBox2.Text ="Index"+ Convert.ToString(t);
                            textBox3.Text = "x" + Convert.ToString(a);
                            textBox4.Text = "y" + Convert.ToString(h);
                      //  textBox2.Text =textBox2.Text + Environment.NewLine + "Index= " + (Convert.ToString(t)); 
                      //  textBox3.Text = textBox3.Text +Environment.NewLine + "x= " + (Convert.ToString(a));
                     //   textBox4.Text = textBox4.Text +Environment.NewLine + "y= " + (Convert.ToString(h));
                          }
                        f = f + 20;

                    }
                    yes[a, h] = t;

                    t++;
                    if (a == 5 && h == 7)
                    {
                        break;
                    }   
                    
                   
                  /*   if (a == 2)
                    {   
                        f = 130;
                        d=d+20;
                        System.Drawing.Graphics graphics = this.CreateGraphics();
                        System.Drawing.Rectangle square = new System.Drawing.Rectangle(f, d, 5, 5);
                        graphics.DrawRectangle(System.Drawing.Pens.Red, square);


                    } */
                    
                        }
                    }
                }

       private void textBox2_TextChanged(object sender, EventArgs e)
       {
          
       }

       private void textBox3_TextChanged(object sender, EventArgs e)
       {

       }

       private void textBox5_TextChanged(object sender, EventArgs e)
       {
            
       }
     }
  }


modified 25-Jun-15 11:55am.

AnswerRe: HOw to solve input string was not in the correct format Pin
Pete O'Hanlon25-Jun-15 4:58
mvePete O'Hanlon25-Jun-15 4:58 
GeneralRe: HOw to solve input string was not in the correct format Pin
Siao Da25-Jun-15 5:08
Siao Da25-Jun-15 5:08 
GeneralRe: HOw to solve input string was not in the correct format Pin
CHill6025-Jun-15 6:04
mveCHill6025-Jun-15 6:04 
QuestionDoes anyone experienced in the text-to-speech in C# WinForm ? Pin
goldsoft24-Jun-15 23:51
goldsoft24-Jun-15 23:51 
AnswerRe: Does anyone experienced in the text-to-speech in C# WinForm ? Pin
Mycroft Holmes24-Jun-15 23:56
professionalMycroft Holmes24-Jun-15 23:56 
AnswerRe: Does anyone experienced in the text-to-speech in C# WinForm ? Pin
Eddy Vluggen25-Jun-15 9:48
professionalEddy Vluggen25-Jun-15 9:48 
QuestionWhat to do if I want to return rows from different tables in ASP.NET WebService Pin
jasonalien24-Jun-15 22:41
jasonalien24-Jun-15 22:41 
AnswerRe: What to do if I want to return rows from different tables in ASP.NET WebService Pin
F-ES Sitecore25-Jun-15 0:02
professionalF-ES Sitecore25-Jun-15 0:02 
GeneralRe: What to do if I want to return rows from different tables in ASP.NET WebService Pin
jasonalien25-Jun-15 0:14
jasonalien25-Jun-15 0:14 
GeneralRe: What to do if I want to return rows from different tables in ASP.NET WebService Pin
F-ES Sitecore25-Jun-15 0:23
professionalF-ES Sitecore25-Jun-15 0:23 
Questionstoring result into byte[] Pin
Member 1171394224-Jun-15 21:04
Member 1171394224-Jun-15 21:04 
AnswerRe: storing result into byte[] Pin
Pete O'Hanlon24-Jun-15 23:50
mvePete O'Hanlon24-Jun-15 23:50 
GeneralRe: storing result into byte[] Pin
Member 1171394227-Jun-15 0:39
Member 1171394227-Jun-15 0:39 
QuestionWinform MDI child form render not properly. Pin
kutty balaji24-Jun-15 20:42
kutty balaji24-Jun-15 20:42 
AnswerRe: Winform MDI child form render not properly. Pin
Dave Kreskowiak25-Jun-15 3:42
mveDave Kreskowiak25-Jun-15 3:42 
QuestionOwn Mail Server with own domain Pin
abhijit.mdccb24-Jun-15 20:20
abhijit.mdccb24-Jun-15 20:20 
AnswerRe: Own Mail Server with own domain Pin
Richard MacCutchan24-Jun-15 22:15
mveRichard MacCutchan24-Jun-15 22:15 

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.