Click here to Skip to main content
13,357,973 members (53,940 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear All,

i want to set the location of created dynamic control from the database. i have 2 records with 2 fields in table. so i want to set 1 record in 1st row and then 2nd record in 2nd row..

i am not success to set the location of dynamic controlllll...

please help...

Thanks and Regards....
Posted 3-Aug-12 0:42am
Aditya Mangipudi 3-Aug-12 10:42am
Can you post some code to show what you are doing?
"Not success" is not informative. What was the problem? Creation of controls is trivial...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There are no dynamic vs. non-dynamic controls. They are all equally "dynamic".

There are two things you might no understand. First, avoid finding location for a control. Instead, prefer using docking in combination of padding. In some cases, anchors could be useful, but they can create some flicker on resize, depending on what's anchored. Please see:[^],[^],[^].

However, as absolute position is hardly acceptable if you are using the Designer, it can be used when you position controls "dynamically", which just means manually written code, without using the Debugger. By the way, manually written code is more supportable.

You might have another problem, writing the code inserting controls. Basically, it's done using Control.Controls.Add (for a parent control) or assigning a parent reference to Control.Parent, but I usually also recommend a very universal method of learning how to insert/arrange control. Add few control as you like using the Designer, temporarily, just for learning purpose. Look at the auto-generated code. You can easily learn how to code the same thing in your code.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180111.1 | Last Updated 3 Aug 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100