Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Help with DataGrid

Help with DataGrid

Scheduled Pinned Locked Moved ASP.NET
helpquestion
14 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B bryan paling

    HI Guys, Im having trouble converting the value of the Texbox(string) to Integer. Here is my code: Dim TSF as Double Dim txtemailid as Textbox if (IsPostBack) then For Each i in dbgInbox.Items txtemailid = i.FindControl("txttsf") TSF = txtemailid.Text if (TSF = 1) then lbl1.Text = "one" else lbl1.Text = "two" end if Next end if I also tried using TSF = Convert.ToInt32(txtemailid.Text) - error was "Input String was not in a correct format" and the other one TSF = Int.Parse(txtemailid.Text) - error was "Overload resolution failed because no accessible 'Int' accepts this number of arguments" Anyone who can help on this? :) Thanks a lot.. -bryan

    I Offline
    I Offline
    Imran Khan Pathan
    wrote on last edited by
    #2

    try this code TSF =Convert.ToInt32(txtemailid.Text) Best Regard Pathan

    ---------------------------------------------------

    B 1 Reply Last reply
    0
    • I Imran Khan Pathan

      try this code TSF =Convert.ToInt32(txtemailid.Text) Best Regard Pathan

      ---------------------------------------------------

      B Offline
      B Offline
      bryan paling
      wrote on last edited by
      #3

      Hi Pathan, I already tried it, but when I tried to enter a number on the Textbox, the error I received was "Input String was not in a correct Format". any other options??

      --- If the facts don't fit the Theory, change the facts...

      I 1 Reply Last reply
      0
      • B bryan paling

        Hi Pathan, I already tried it, but when I tried to enter a number on the Textbox, the error I received was "Input String was not in a correct Format". any other options??

        --- If the facts don't fit the Theory, change the facts...

        I Offline
        I Offline
        Imran Khan Pathan
        wrote on last edited by
        #4

        I think i.FindControl("txttsf") returns NULl. check it first. Best Regard Pathan

        ---------------------------------------------------

        B 1 Reply Last reply
        0
        • I Imran Khan Pathan

          I think i.FindControl("txttsf") returns NULl. check it first. Best Regard Pathan

          ---------------------------------------------------

          B Offline
          B Offline
          bryan paling
          wrote on last edited by
          #5

          No. I tried to enter a string like the word "one" and it displayed on the label the word one, as it says on the condition statements. But when I tried to enter a number, the problem now occurs. regards bryan

          --- If the facts don't fit the Theory, change the facts...

          I 1 Reply Last reply
          0
          • B bryan paling

            No. I tried to enter a string like the word "one" and it displayed on the label the word one, as it says on the condition statements. But when I tried to enter a number, the problem now occurs. regards bryan

            --- If the facts don't fit the Theory, change the facts...

            I Offline
            I Offline
            Imran Khan Pathan
            wrote on last edited by
            #6

            Ok now Check it Dim out As Integer If Integer.TryParse(txtemailid.Text, out) = True Then Response.Write("Done") else Response.Write("Failed") End If //Input values must be an Intger Best Regard Pathan

            ---------------------------------------------------

            B 1 Reply Last reply
            0
            • I Imran Khan Pathan

              Ok now Check it Dim out As Integer If Integer.TryParse(txtemailid.Text, out) = True Then Response.Write("Done") else Response.Write("Failed") End If //Input values must be an Intger Best Regard Pathan

              ---------------------------------------------------

              B Offline
              B Offline
              bryan paling
              wrote on last edited by
              #7

              Here's the result: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'TryParse' is not a member of 'Integer'. Source Error: Line 170: Dim out As Integer Line 171: If Integer.TryParse(txtemailid.Text, out) = True Then Line 172: Response.Write("Done") Line 173: else I also tried using Int.TryParse but this error occured "Overload resolution failed because no accessible 'Int' accepts this number of arguments." regards bryan

              --- If the facts don't fit the Theory, change the facts...

              I 1 Reply Last reply
              0
              • B bryan paling

                Here's the result: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'TryParse' is not a member of 'Integer'. Source Error: Line 170: Dim out As Integer Line 171: If Integer.TryParse(txtemailid.Text, out) = True Then Line 172: Response.Write("Done") Line 173: else I also tried using Int.TryParse but this error occured "Overload resolution failed because no accessible 'Int' accepts this number of arguments." regards bryan

                --- If the facts don't fit the Theory, change the facts...

                I Offline
                I Offline
                Imran Khan Pathan
                wrote on last edited by
                #8

                'TryParse' is not a member of 'Integer'.:confused: Ok try with System.Int32 Best regard Pathan

                ---------------------------------------------------

                B 1 Reply Last reply
                0
                • I Imran Khan Pathan

                  'TryParse' is not a member of 'Integer'.:confused: Ok try with System.Int32 Best regard Pathan

                  ---------------------------------------------------

                  B Offline
                  B Offline
                  bryan paling
                  wrote on last edited by
                  #9

                  the same error occured, TryParse is not a member of Integer. I tried using this code: For Each i in dbgInbox.Items txtemailid = i.FindControl("txttsf") Dim out As Integer If Integer.Parse(txtemailid.Text, out) = True Then Response.Write("Done") else Response.Write("Failed") End If Next when I entered a number on the Textbox, the error "Input string was not in a correct format" appeared. maybe i just missed a code in here... "If Integer.Parse(txtemailid.Text, out) = True Then" regards bryan

                  --- If the facts don't fit the Theory, change the facts...

                  I 1 Reply Last reply
                  0
                  • B bryan paling

                    the same error occured, TryParse is not a member of Integer. I tried using this code: For Each i in dbgInbox.Items txtemailid = i.FindControl("txttsf") Dim out As Integer If Integer.Parse(txtemailid.Text, out) = True Then Response.Write("Done") else Response.Write("Failed") End If Next when I entered a number on the Textbox, the error "Input string was not in a correct format" appeared. maybe i just missed a code in here... "If Integer.Parse(txtemailid.Text, out) = True Then" regards bryan

                    --- If the facts don't fit the Theory, change the facts...

                    I Offline
                    I Offline
                    Imran Khan Pathan
                    wrote on last edited by
                    #10

                    "If Integer.Parse(txtemailid.Text, out) = True Then" is wrong bcoz Integer.Parse does not return bool. Use Integer.TryParse if u got "TryParse is not a member of Integer. " this error then try with this System.Int32.TryParse Best Regard Pathan

                    ---------------------------------------------------

                    I B 2 Replies Last reply
                    0
                    • I Imran Khan Pathan

                      "If Integer.Parse(txtemailid.Text, out) = True Then" is wrong bcoz Integer.Parse does not return bool. Use Integer.TryParse if u got "TryParse is not a member of Integer. " this error then try with this System.Int32.TryParse Best Regard Pathan

                      ---------------------------------------------------

                      I Offline
                      I Offline
                      Imran Khan Pathan
                      wrote on last edited by
                      #11

                      Which verson of .Net r u using? Best Regard Patha

                      ---------------------------------------------------

                      B 1 Reply Last reply
                      0
                      • I Imran Khan Pathan

                        "If Integer.Parse(txtemailid.Text, out) = True Then" is wrong bcoz Integer.Parse does not return bool. Use Integer.TryParse if u got "TryParse is not a member of Integer. " this error then try with this System.Int32.TryParse Best Regard Pathan

                        ---------------------------------------------------

                        B Offline
                        B Offline
                        bryan paling
                        wrote on last edited by
                        #12

                        hi... the same error occurs.. :(

                        --- If the facts don't fit the Theory, change the facts...

                        I 1 Reply Last reply
                        0
                        • I Imran Khan Pathan

                          Which verson of .Net r u using? Best Regard Patha

                          ---------------------------------------------------

                          B Offline
                          B Offline
                          bryan paling
                          wrote on last edited by
                          #13

                          I hate this coding because i'm coding inside the code not the codebehind. I'm using 1.1 version -bryan <div class="ForumSig">--- If the facts don't fit the Theory, change the facts...</div></x-turndown>

                          1 Reply Last reply
                          0
                          • B bryan paling

                            hi... the same error occurs.. :(

                            --- If the facts don't fit the Theory, change the facts...

                            I Offline
                            I Offline
                            Imran Khan Pathan
                            wrote on last edited by
                            #14

                            You can not use TryParse method in 1.1 Sorry Pathan

                            ---------------------------------------------------

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups