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. Text is getting typed into another text box

Text is getting typed into another text box

Scheduled Pinned Locked Moved Visual Basic
graphicshelp
6 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.
  • T Offline
    T Offline
    tiagu
    wrote on last edited by
    #1

    I need help with the following code.   I am building a custom control.   I am storing controls in arrays as I need more rows.   When I type into the second text box as soon as i run the program the text is typed into the first text box.   Please help.   I thank you in advance. Imports System.Drawing Imports System.Windows.Forms Public Class UserControl1       Dim arrText1(1), arrtext2(1) As TextBox       Public Sub SetTextBoxes()             Dim text1 As New TextBox()             With text1                   .Name = "text1"                   .Left = 8                   .Font = New Font(.Font.Name, 14, FontStyle.Regular, .Font.Unit)                   .Size = New Point(80, 30)                   Me.Controls.Add(text1)                   arrText1(0) = text1             End With             Dim text2 As New TextBox()             With text2                   .Name = "text2"                   .Left = 100                   .Font = New Font(.Font.Name, 14, FontStyle.Regular, .Font.Unit)                   .Size = New Point(80, 30)                   Me.Controls.Add(text2)                   arrtext2(0) = text2             End With       End Sub       Private Sub ucGrid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load             SetTextBoxes()       End Sub End Class :confused:

    J 1 Reply Last reply
    0
    • T tiagu

      I need help with the following code.   I am building a custom control.   I am storing controls in arrays as I need more rows.   When I type into the second text box as soon as i run the program the text is typed into the first text box.   Please help.   I thank you in advance. Imports System.Drawing Imports System.Windows.Forms Public Class UserControl1       Dim arrText1(1), arrtext2(1) As TextBox       Public Sub SetTextBoxes()             Dim text1 As New TextBox()             With text1                   .Name = "text1"                   .Left = 8                   .Font = New Font(.Font.Name, 14, FontStyle.Regular, .Font.Unit)                   .Size = New Point(80, 30)                   Me.Controls.Add(text1)                   arrText1(0) = text1             End With             Dim text2 As New TextBox()             With text2                   .Name = "text2"                   .Left = 100                   .Font = New Font(.Font.Name, 14, FontStyle.Regular, .Font.Unit)                   .Size = New Point(80, 30)                   Me.Controls.Add(text2)                   arrtext2(0) = text2             End With       End Sub       Private Sub ucGrid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load             SetTextBoxes()       End Sub End Class :confused:

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      The code you posted here appears to work just fine. Whatever is causing the problem must be somewhere else. What are the arrays for?

      My advice is free, and you may get what you paid for.

      T 1 Reply Last reply
      0
      • J Johan Hakkesteegt

        The code you posted here appears to work just fine. Whatever is causing the problem must be somewhere else. What are the arrays for?

        My advice is free, and you may get what you paid for.

        T Offline
        T Offline
        tiagu
        wrote on last edited by
        #3

        Thanks for the fast reply.   It happens only the first time you run the code and type into the second text box. Otherwise it works fine. I am using the arrays in order to have more rows in my control (sort of control array of vb6).   This code works fine with my regular windows form in vb.net 2008.   But it does not work in my user control form in vb.net 2008.   Please help.

        modified on Monday, May 18, 2009 7:48 AM

        J 1 Reply Last reply
        0
        • T tiagu

          Thanks for the fast reply.   It happens only the first time you run the code and type into the second text box. Otherwise it works fine. I am using the arrays in order to have more rows in my control (sort of control array of vb6).   This code works fine with my regular windows form in vb.net 2008.   But it does not work in my user control form in vb.net 2008.   Please help.

          modified on Monday, May 18, 2009 7:48 AM

          J Offline
          J Offline
          Johan Hakkesteegt
          wrote on last edited by
          #4

          So apparently the error is caused by some difference between the standard windows form and your user control form. I suppose you'll need to check what differences there are between the two.

          My advice is free, and you may get what you paid for.

          T 1 Reply Last reply
          0
          • J Johan Hakkesteegt

            So apparently the error is caused by some difference between the standard windows form and your user control form. I suppose you'll need to check what differences there are between the two.

            My advice is free, and you may get what you paid for.

            T Offline
            T Offline
            tiagu
            wrote on last edited by
            #5

            Thank you Johan.   I will try to figure out the difference between both.   Thanks once again.

            T 1 Reply Last reply
            0
            • T tiagu

              Thank you Johan.   I will try to figure out the difference between both.   Thanks once again.

              T Offline
              T Offline
              tiagu
              wrote on last edited by
              #6

              Hi Johan, this is for your information.   I have placed two text boxes in the user control (Design time) without any coding.   Still the text i type in the second text box is getting typed in the first text box and the cursor in the second text box is moving as per the characters typed (giving out blank spaces in the first text box).   Any idea what the problem could be.   Do you think i should reinstall vb.net ?!

              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