Click here to Skip to main content
15,902,445 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How i will add controls dynamically at the top of the panel??

My problem:

I have 5 notifications . After each 10 second a timer will run and take data from database. If new notification found than that will insert to the panel at the top.Means new notifications will present at the top and older are at the button. Every time when new notification will come it will feed at the top and then it will show the older notification.

Example:first i have 5 notifications 2 new came than that 2 notifications will present at the top and than the 5 notifications.After 10 seconds again 4 new notifications came than that 4 new notifications will present at the top and rest 7 older notifications will remain at the button and so on.

please suggest how i will solve this problem or any alternate ideas to solve this problem .

Thanks
Posted
Updated 2-Apr-12 20:22pm
v2
Comments
Sergey Alexandrovich Kryukov 3-Apr-12 1:53am    
Tag it: WPF? Forms? Silverlight? ASP.NET? What?
--SA
bhagirathimfs 3-Apr-12 2:13am    
Forms
Sergey Alexandrovich Kryukov 3-Apr-12 2:26am    
Thanks for tagging. I already gave you the recipe, but with forms it is much simpler. The auto-generated code I advised to create with the designer will be generated under the Solution Explorer form node. Look at it to see how to code the layout you need. Really simple thing.
--SA

1 solution

I have a very general cookbook recipe for many problems of such kind.

You have a doubt how to create some part of UI in code? But can you make just a sample of the UI design you want using the designer? If so, do it in designer in some research project. Do bare layout; everything else you can add later in code. It may take just few minutes. Compile and run the sample to make sure it works as you wanted.

When this is done, locate the code auto-generated during design time. If you don't know yes where to find it, use file search by sub-string (for WPF, do it not from Visual Studio, search from outside), for a search substring, use some member name of the member created by the designed (for WPF, create at least one Name attribute of some UI element).

Now, take a look at the auto-generated code and learn how it works. This is really simple.

[EDIT]

You should understand that every control is added dynamically. The designed simply helps to generate the code, but once generated, it works during run time exactly the same way you would program it by hand. Remember that in many cases programming by hand is faster (because programming "with mouse" is a manual labor, it cannot use efficient programming abstractions like loops and code reuse) and can give better quality, so your request makes perfect sense.

The method of using designer for learning has proven its usefulness.

—SA
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900