7 Replies - 405 Views - Last Post: 26 June 2013 - 04:18 PM Rate Topic: -----

#1 add_me  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-June 13

dynamic created textbox and button

Posted 26 June 2013 - 12:33 PM

please help me to on this code where im not able to get the textbox.text to view in msgbox using button

i have sucessfully create dynamic textbox and button but im not able to get the entered values in the text box please. help me on this...


Public Class Form1
 

    Dim txtadd1 As New TextBox()
    Dim txtadd2 As New TextBox()
    Dim Buttonadd5 As New Button()
 

 
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
                  
                Dim Paneladd As New Panel
                Me.Controls.Add(Paneladd)
 
                For i = 1 To 1
 
                    Paneladd.Top = 0
                    Paneladd.Height = 25
                    Paneladd.Dock = DockStyle.Top
 
                    txtadd1 = New TextBox
                    txtadd1.Name = "txtadd1" + (i).ToString
                    txtadd1.Text = "txtadd1" + (i).ToString
                    txtadd1.Left = 0
                    txtadd1.Size = New System.Drawing.Size(100, 10)
                    txtadd1.Enabled = False
 
                    txtadd2 = New TextBox
                    txtadd2.Name = "txtadd2" + (i).ToString
                    txtadd2.Text = "txtadd2" + (i).ToString
                    txtadd2.Left = 100
                    txtadd2.Size = New System.Drawing.Size(100, 10)
                    txtadd2.Enabled = False
 
                    Buttonadd5 = New Button
                    Buttonadd5.Name = "Buttonadd" + (i).ToString
                    Buttonadd5.Text = dr.GetValue(0).ToString()
                    Buttonadd5.Left = 500
                    Buttonadd5.TextAlign = HorizontalAlignment.Center
 
               Next

                Panel3.Controls.Add(Paneladd)
                Paneladd.Controls.Add(txtadd1)
                Paneladd.Controls.Add(txtadd2)
                Paneladd.Controls.Add(Buttonadd5)
                   
         End Sub
end class




Is This A Good Question/Topic? 0
  • +

Replies To: dynamic created textbox and button

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,177
  • Joined: 12-June 08

Re: dynamic created textbox and button

Posted 26 June 2013 - 12:44 PM

Quote

i have sucessfully create dynamic textbox and button but im not able to get the entered values in the text box please

What do you mean?
Was This Post Helpful? 0
  • +
  • -

#3 add_me  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-June 13

Re: dynamic created textbox and button

Posted 26 June 2013 - 12:49 PM

View Postmodi123_1, on 26 June 2013 - 12:44 PM, said:

Quote

i have sucessfully create dynamic textbox and button but im not able to get the entered values in the text box please

What do you mean?



i have create textbox and button in the code like (form_load) like

textbox1 button1
textbox2 button2
textbox3 button3
textbox4 button4
textbox5 button5

but i wanted the button1 to access the textbox1 value and show me in the msgbox
same as button2 to access the textbox2


please show me a way that i can see the value..
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,177
  • Joined: 12-June 08

Re: dynamic created textbox and button

Posted 26 June 2013 - 12:56 PM

Use the messagebox.show in the button click events and make sure the incoming string is the corresponding textbox's text property.


MessageBox.Show(<string value>);

Was This Post Helpful? 0
  • +
  • -

#5 add_me  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-June 13

Re: dynamic created textbox and button

Posted 26 June 2013 - 01:18 PM

View Postmodi123_1, on 26 June 2013 - 12:56 PM, said:

Use the messagebox.show in the button click events and make sure the incoming string is the corresponding textbox's text property.


MessageBox.Show(<string value>);



my textbox's are dynamically create i tried by i failed can you post me some code please to refer please
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,177
  • Joined: 12-June 08

Re: dynamic created textbox and button

Posted 26 June 2013 - 01:22 PM

You asked for messagebox code.. there it is. If you have strange case of dynamically added controls then you need to stop, think things through, and determine what would be the best way of attaching events to a series of 0 to N GUI controls and determining who was the caller of said event firing.
Was This Post Helpful? 0
  • +
  • -

#7 add_me  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-June 13

Re: dynamic created textbox and button

Posted 26 June 2013 - 04:15 PM

View Postmodi123_1, on 26 June 2013 - 12:56 PM, said:

Use the messagebox.show in the button click events and make sure the incoming string is the corresponding textbox's text property.


MessageBox.Show(<string value>);



my textbox's are dynamically create i tried by i failed can you post me some code please to refer please
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9096
  • View blog
  • Posts: 34,177
  • Joined: 12-June 08

Re: dynamic created textbox and button

Posted 26 June 2013 - 04:18 PM

I assume you have read the rules, FAQ, the box you type responses in about telling folks to just give you the code, right? RIGHT?

So.. let's see what you have tried.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1