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. General Programming
  3. C#
  4. removing the last character of textbox

removing the last character of textbox

Scheduled Pinned Locked Moved C#
19 Posts 5 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.
  • C Christian Graus

    Rajesh Jalsa wrote:

    autocompletelist is called by a webmethod.., i think he has to put login in web method ..

    Is this for a website ?

    Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

    N Offline
    N Offline
    NarendraSinghJTV
    wrote on last edited by
    #9

    no it is not for a website, it is for windows application, thank you

    1 Reply Last reply
    0
    • C Christian Graus

      What is the problem ? Where are you stuck ? It's very easy to do. Check the Substring method of the string class.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      N Offline
      N Offline
      NarendraSinghJTV
      wrote on last edited by
      #10

      thank u, its working now but the autocomplete dropdown list not coming when the last character removed

      1 Reply Last reply
      0
      • C Christian Graus

        How about textbox1.Text = textbox1.Text.Substring(0, textbox1.Text.Length -1 ); ? However, if you read the other posts, we think he's writing a web app. He also doesn't seem to really want help, he's not posting back.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        N Offline
        N Offline
        NarendraSinghJTV
        wrote on last edited by
        #11

        no christian i want help, i have some problem with my internet connection thats why i m not able to rply, n i m creating a window application

        1 Reply Last reply
        0
        • A AhmedMasum

          Try the following: private void button1_Click(object sender, EventArgs e) { String s = textBox1.Text; s = s.Remove(s.Length - 1); textBox1.Text = s; } I think you got the solution.

          N Offline
          N Offline
          NarendraSinghJTV
          wrote on last edited by
          #12

          thanks for rply ur code work fine now when my last character is removed i want to show auto complete drop down again without pressing any key can u help me with that thanks in advance

          A 1 Reply Last reply
          0
          • R Rajesh Anuhya

            may be.., because the question is sounds like ,this was related to webservice/web site.., @ Question poster clarify our doubt... !!!!!

            Rajesh B --> A Poor Workman Blames His Tools <--

            N Offline
            N Offline
            NarendraSinghJTV
            wrote on last edited by
            #13

            hey rajesh thanks for rply actually i m creating a window application in which i m generating the auto complete source of a textbox from database what i want to do is when user types in textbox if thr is no matching result then typed character should be removed and autocomplete dropdownlist appear again with the matching result. i dont want to permit the user to type wrong entry

            1 Reply Last reply
            0
            • C Christian Graus

              What is the problem ? Where are you stuck ? It's very easy to do. Check the Substring method of the string class.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              N Offline
              N Offline
              NarendraSinghJTV
              wrote on last edited by
              #14

              hey christian sory for late rply actually i m creating a window application in which i m generating the auto complete source of a textbox from database what i want to do is when user types in textbox if thr is no matching result then typed character should be removed and autocomplete dropdownlist appear again with the matching result. i dont want to permit the user to type wrong entry thanks for ur rply in advance

              P 1 Reply Last reply
              0
              • N NarendraSinghJTV

                hey christian sory for late rply actually i m creating a window application in which i m generating the auto complete source of a textbox from database what i want to do is when user types in textbox if thr is no matching result then typed character should be removed and autocomplete dropdownlist appear again with the matching result. i dont want to permit the user to type wrong entry thanks for ur rply in advance

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #15

                Could you handle that in the KeyPress event instead?

                N 1 Reply Last reply
                0
                • N NarendraSinghJTV

                  thanks for rply ur code work fine now when my last character is removed i want to show auto complete drop down again without pressing any key can u help me with that thanks in advance

                  A Offline
                  A Offline
                  AhmedMasum
                  wrote on last edited by
                  #16

                  Can you clear me the question? I am not understanding your question.

                  N 2 Replies Last reply
                  0
                  • A AhmedMasum

                    Can you clear me the question? I am not understanding your question.

                    N Offline
                    N Offline
                    NarendraSinghJTV
                    wrote on last edited by
                    #17

                    ok, when we type any character in a textbox which have autocomplete option it shows a list of matched items. when we press any wrong character or the character which does not match with the autocomplete list the list is disappered. At that time if we press backspace then again autocomplete list appears with the matching items. like that i want to show the item list again by removing last unmatched character programatically like e.g.(textbox.length-1). I think autocomplete list generates on key_press event of textbox. Hope now it is easy to understand waiting for ur rply thanks in advance for ur rply

                    1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      Could you handle that in the KeyPress event instead?

                      N Offline
                      N Offline
                      NarendraSinghJTV
                      wrote on last edited by
                      #18

                      i m already using it on keypress event thanks for rply

                      1 Reply Last reply
                      0
                      • A AhmedMasum

                        Can you clear me the question? I am not understanding your question.

                        N Offline
                        N Offline
                        NarendraSinghJTV
                        wrote on last edited by
                        #19

                        ok i think it doesnt have any solution thanks for all the rplys

                        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