views:

23

answers:

1

am using C#, VS-2005

Is it possible to create row by using TextBoxes in Panel and increment the same as per panel vertical scrollbar.

Suppose I have Three Column which is Draw by Label on specific area of panel and wants to draw raw by textboxes for above mention column and increment the same by clicking enter keypress event. as below.

Name Address Amount

the above is column and require row for the same.

is it possible. if yes then provide me some code. else guide me please.

A: 

We had almost the same task, but it was more complex - not only TextBoxt, but also ComboBoxes. Solved it by creating a UserControl (one row, constructed of elements we needed) and adding this control each time on user request.

So, we created a UserControl in our project and placed the needed elements on it. If you expect your panel and rows to be sizable, then you need to be very careful with element's Anchors. Be sure, that the initial width of the row and the panel are the same plus some interval from the left and right borders of the panel (if needed).

Each time user presses Enter or Button, whatever, you should dinamically create a new UserControl and place it on the panel. The trick is to place it right under the last existent row. To do it correctly, get the location of the last existent row (from the Panel.Controls collection), add row height and some interval if needed, and set the location of the new row equal to that number.

26071986
very true sir,if u get it then please suggest me.
mahesh
can u provide me some example with two textboxes with code
mahesh
@mahesh Sorry, I gave you instructions. Details like how to create UserControls, set Location and dynaically add controls on panel you should be able to find yourself, that's quite simple. Try MSDN, for example.
26071986