VB.NET Getting Value On Dynamic Control -


I am new to VB and participate in some problems.

I have created a sub-rule that automatically adds a control to each panel when I click on the button, so it can make as much as you want.

Here is the code for sub-routine.

  Create a private sub CreateControl () 'TEXTBOX ITEMNO Dim i_Itemno as integer = TextEditItemno.Length Radem TextEditItemno (i_Itemno) Save TextEditItemno (i_Itemno) New TextEdit with TextEditItemno (i_Itemno) Name = "Txtitemno" & amp; I_Itemno.ToString () If TextEditItemno.Length & lt; 2 And .SetBounds (0, 0, 32, 20) or .Left = TextEditItemno (i_Itemno - 1) .Left .Top = TextEditItemno (i_Itemno - 1) .Top + TextEditItemno (i_Itemno - 1) .Height 4 .Size = TextEditItemno (I_Itemno - 1). Tag I_Itemno End with Add.Handler TextEditItemno (i_Itemno) After the text, the edit command at the address of the textManotext Changing PanelControl5. Control. Add TextEditItemno (i_Itemno) 'TextGet PRICE dim i_Price as an integer = TextEditPrice.Length Redeemed Secure TextEditPrice ((i_Price)) Dim PriceX int16 = LblHarga.Location.X TextEditPrice (i_Price) = TextEditPrice (i_Price) New TextEdit with .Name = "Txtprice" & amp; I_Price.ToString () if TextEditSatuan.Length & lt; 2 And .SetBounds (PriceX, 0, 70, 20) or .Left = TextEditPrice (i_Price - 1) .Left .Top = TextEditPrice (i_Price - 1) .Top + TextEditPrice (i_Price - 1) .Height 4 .Size = TextEditPrice (i_Price - 1) .Size finally AddHandler TextEditPrice (i_Price) .TextChanged, AddressOf TextEditPrice_TextChanged PanelControl5.Controls.Add (TextEditPrice (i_Price) with) end Sub  .Tag = i_Price end 

and I call it in a button click.

  private sub btnNew_Click (ByVal this System.Object, ByVal e System.EventArgs) as handle btnNew.Click CreateControl () End Sub  
< P> Now what I am looking for is how the loop and value of those text boxes, no matter how many textboxex I have created.

  i <= 0 as integer / Code>  

Thank you

This code goes into its loop and becomes the value of each text box based on i .

  String = Dim Text (I) as textEditItemno. Text  

You may be better served by using List (text box) instead of an array of text boxes is about reducing the array There is no need to worry, you can simply MyListOfTextboxes.Add (TheNewTextBox) . You can still retrieve the value of every text box in the same way as the array.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -