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
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to change the textbox control source property

how to change the textbox control source property

Scheduled Pinned Locked Moved Visual Basic
helptutorial
4 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.
  • I Offline
    I Offline
    iramg
    wrote on last edited by
    #1

    i want to save the text of textbox in a string defined by me. i dont want to access the textbox text by textbox1.Text method. i want to know by which property i can change the by default location of the text. so plz help me as soon as possible

    K 1 Reply Last reply
    0
    • I iramg

      i want to save the text of textbox in a string defined by me. i dont want to access the textbox text by textbox1.Text method. i want to know by which property i can change the by default location of the text. so plz help me as soon as possible

      K Offline
      K Offline
      Kschuler
      wrote on last edited by
      #2

      Your question is hard to understand. Are you just asking how to put text from a textbox into your own string? If so, that looks like this: Dim myString as String = txtMyTextbox.Text Then you can manipulate the myString value without changing the text currently in the textbox. Is that what you were asking for? Or wait...maybe you mean you want to use the textboxes TextChanged Event. When ever the text inside the box changes it fires. It would look something like this: Private myString as String = "" Private Sub txtMyTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMyTextbox.TextChanged myString = txtMyTextbox.Text End Sub

      I 1 Reply Last reply
      0
      • K Kschuler

        Your question is hard to understand. Are you just asking how to put text from a textbox into your own string? If so, that looks like this: Dim myString as String = txtMyTextbox.Text Then you can manipulate the myString value without changing the text currently in the textbox. Is that what you were asking for? Or wait...maybe you mean you want to use the textboxes TextChanged Event. When ever the text inside the box changes it fires. It would look something like this: Private myString as String = "" Private Sub txtMyTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMyTextbox.TextChanged myString = txtMyTextbox.Text End Sub

        I Offline
        I Offline
        iramg
        wrote on last edited by
        #3

        no actually i want to chnage the property means when ever i changed a text it should save in a string which is declared by me. means i dont want to get the text from txtMyTextbox.text. i just want to access it directly from my decalred string. ok got it?

        K 1 Reply Last reply
        0
        • I iramg

          no actually i want to chnage the property means when ever i changed a text it should save in a string which is declared by me. means i dont want to get the text from txtMyTextbox.text. i just want to access it directly from my decalred string. ok got it?

          K Offline
          K Offline
          Kschuler
          wrote on last edited by
          #4

          Ok. I get it. But there isn't a way to get the text out of a textbox without using the myTextbox.Text method. It sounds like the closest way to accomplish it what I mentioned earlier...set your string variable everytime the text in the text box changes by adding code to the textbox object's OnTextChanged event. Like this:

          Private myString as String = ""

          Private Sub txtMyTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMyTextbox.TextChanged
          myString = txtMyTextbox.Text
          End Sub

          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