PDA

Click to See Complete Forum and Search --> : [RESOLVED] Using a panel in a windows form....


HardD99
Jul 3rd, 2006, 11:38 PM
Ok i am using a C# windows form and Visual Studio 2005.

I have a form that is displaying a bunch of customer info on the bottom half of the form and then i have a panel on top of that portion of that form that has a datagrid on it. at the top is the search field so when you type a name and click search the panel sets to visible and shows the datagrid, then u select from the list and click submit and the panel goes back to visible=false and it shows the customer info again. this is working great for my application but the problem comes in when i try to work on the form. Is there a way to hide the panel when i am in design view? i cant edit things easily behind that panel, is there an easier way of doing this? or maybe another way to accomplish the same thing without using a panel?

sorry if i typed alot but its kinda hard to explain, hehe.
thx guyz

jmcilhinney
Jul 4th, 2006, 12:10 AM
Just use two Panels: one with one set of controls on it an one with the other set. You can then right-click one of the Panels in the designer and select "Send to Back" and it will go behind the other one. Whenever you want to work on the one you can't see you just send the one you can see to the back of the z-order.

The one thing you need to be careful of with this technique is that you don't put one Panel inside the other. Make sure you click the form before adding each Panel from the Toolbox to make sure it is parented by the form. Then you should generall avoid dragging the Panels around in the design window as it is easy to accidentally drop them on each other, thus making one the parent of another. Once you have your Panels on the form you should set their Location and Size properties manually in the Properties window.

Finally, are you really using a DataGrid? If so then I recommend that you don't and use a DataGridView instead. If you're already using a DataGridView then I suggest that you be careful with your terminology because they are certainly not the same thing, and if someone give you advice for one and you're using the other then you will have wasted their time.

HardD99
Jul 4th, 2006, 12:24 AM
thats alot of help man i really appriciate it. atleast now i know im going down the right street, :).

and yeah i am using a datagridview, sorry about that, im just used to using a webform, hehe.