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. C#
  4. displaying data in more than one textbox C#

displaying data in more than one textbox C#

Scheduled Pinned Locked Moved C#
questioncsharphelp
4 Posts 3 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.
  • D Offline
    D Offline
    Deques
    wrote on last edited by
    #1

    i have no idea what to name this to. but anyway, i hope i can get some help i have a while loop which shall go through a few textboxes the textboxes are named textBox1, textBox2 my code is following int count = 0; while(blah) { count++; textBox???.Text = "blah"; } I want to dynamically set the different textboxes with different values, the while loop should through textbox1, textbox2 and so on. how do i make that? i hope i explained myself good enough

    S J 2 Replies Last reply
    0
    • D Deques

      i have no idea what to name this to. but anyway, i hope i can get some help i have a while loop which shall go through a few textboxes the textboxes are named textBox1, textBox2 my code is following int count = 0; while(blah) { count++; textBox???.Text = "blah"; } I want to dynamically set the different textboxes with different values, the while loop should through textbox1, textbox2 and so on. how do i make that? i hope i explained myself good enough

      S Offline
      S Offline
      sujithkumarsl
      wrote on last edited by
      #2

      Why You are using this while loop....... You can add all the textboxes to a panel or groupbox then you can use the foreach method like foreach(TextBox txtbox in panelTextBoxes.Controls) { txtbox.Text = " "; }

      My small attempt...

      1 Reply Last reply
      0
      • D Deques

        i have no idea what to name this to. but anyway, i hope i can get some help i have a while loop which shall go through a few textboxes the textboxes are named textBox1, textBox2 my code is following int count = 0; while(blah) { count++; textBox???.Text = "blah"; } I want to dynamically set the different textboxes with different values, the while loop should through textbox1, textbox2 and so on. how do i make that? i hope i explained myself good enough

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        Place each of your textboxes in an Array and set them that way. TextBox [] tbArray = new TextBox[] { this.textBox1, this.textBox2 }; int count = 0; while(blah) { tbArray[count].Text = "Blah"; count++; }

        --- How to get answers to your questions[^]

        D 1 Reply Last reply
        0
        • J J4amieC

          Place each of your textboxes in an Array and set them that way. TextBox [] tbArray = new TextBox[] { this.textBox1, this.textBox2 }; int count = 0; while(blah) { tbArray[count].Text = "Blah"; count++; }

          --- How to get answers to your questions[^]

          D Offline
          D Offline
          Deques
          wrote on last edited by
          #4

          thanks for your answer, it works

          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