In the picture below I have defined a 6-row table layout and placed controls inside its cells, in one cell goes the Label, the other cell for the control its self (a text box for example )
The problem is caused by that field options radio box, it will make the cell so big so then the text box that is under "Preview Data Value" label, goes way below...
How do you suggest fixing this issue?
From my prior experience, I would not use the table layout at all. Instead I would set the anchors on each control to dynamically change with resize.
But if you insist on using the table layout, perhaps you should change the RowSpan attribute of the Preview Data Value cell, and have the label at the top with the text box underneath.
Another option would be to use a container like a GroupBox with a title Attribute that you can set to "Preview Data Value", put the text box in that container and set the "Dock" Attribute to "Fill". Then from the looks of it, you don't even need the last Row.
See this article on MSDN if you want to go totally nuts and implement your own drawing.
Make a seventh row and have the option group span two rows.
Related
I was wondering if it was possible to add more than one item into single tableLayoutPanel?
Currently, I can only insert ONE item, it won't accept anything else. I would like to have for example a richtextBox with label and button inside it. Is is possible? Thanks! I'm not asking for code, I just need to know if it's possible to manually drag and drop these items into single cell in tableLayoutPanel.
It appears you are only allowed one control per cell, if that is what you mean. You can always add a container control such as a panel with it's Dock property set to Fill you can then add your additional controls to it. Or add another tablePanelLayout Control to the Cell and set the row / columns how you need and then add your controls to that. Or as LarTech mentioned in the comments a UserControl would work also.
You Can also add a Panel Control and then add all other stuff to the Panal
Add a container such as a GroupBox or Panel, and set it to fill all available space in the table cell, and that could override the TableLayoutPanel's "one per box" rule so you should be able to add as many controls as you wish
I wanna ask for your opinions/ideas about how to automatically add new Textbox when user click on Add button. In my system, there are 2 Textboxes which user need to enter expenses and price respectively. And there's also a ADD button. When they click on it, another two boxes will automatically generate. Before this, I only have 8 Textboxes for expenses and 8 Textboxes for their price. But it looks quite messy for me so i want to make it more tidy. Thank you
You could use a grid and then have a hidden row that has the same input cells as the other rows. When the add button is clicked, have javascript clone the hidden row and then add then show it, and add it to the bottom of the grid.
If a grid isn't right for your UI then do the same thing with just cloning a text box and showing it. It is often easier to just have a single hidden input field with the proper style applied and then clone it, and then remove the display: hidden.
But it looks quite messy for me so i want to make it more tidy.
GridView should be used to make it visibility better and consume space properly.
Assign the DataSource to your GridView
Set the Text boxes in your Footer
When you click the Add Button, Set the Visibility of your Footer "True"
Once user fills the values in Textbox save it and Bind to the GridView.
Repeat Step 4 to iterate the same process next time.
I'm using a System.Windows.Forms.ListView control in my application with its View property set to "List". However, the content ends up being in coloumns instead of a single coloumn (ie. There are only horizontal scrollbars instead of vertical ones). Is there any way to display the data in a single coloumn?
Yes if you are only displaying text, use the ListView in Detail mode and set the header style to None to remove the column headers. You will also need to ensure your single column fills the box.
Of course unless you need ListView's features you might be able to just use a ListBox instead.
I have a table of about 450 rows that I would like to display in a graphical list for users to view or modify the line items. The users would be selection options from comboboxes and selecting check boxes etc.
I have found a listview class that extends the basic listview to allow for embeding objects but it seems kind of slugish when I load all the rows into it.
I have used a datagridview in the past for comboboxes and checkboxes, but there was a lot of time invested in getting that up and running...not a big fav of mine.
I am looking for sugestions how I can do this with minimal overhead.
thanks
c#, vs2008, .net 2.0, system.windows.forms
If you have a complicated set of controls for each row, this is the simplest way to do it. However, it won't act like a listbox; you won't be able to highlight your rows or navigate with the keyboard.
Create a usercontrol with public property to point to your row
Draw a panel on your form - you will add instances of your 'row' usercontrol at runtime to this panel.
Set the panel to autoscroll (also set property to make the active control scroll into view)
Set the panel's Anchor property so it sizes w/ the window
You can set the form's max/min size properties so the full usercontrol row always shows (have to do to prevent horiz. scroll bar in panel)
Have a routine to add the rows
In a loop, create new usercontrols, set their properties, including the row in the datatable
Also, set the .Top property to the panel's .controls(pnl.controls.count-1) for all but the first one you add
Very simple, allows complicated 'rows', gets the job done. There are better ways to do this if you want listbox-like functionality without coding it yourself, but you may not need that.
I have a web application(ASP.NET2.0 C#) and in it, I have a gridview that gets its data from a datasource.
I wanted to add the following feature: the user can click a button "select columns", and a box pops up with a list of all the columns(a checkboxlist in a div, possibly) and that way, the user can choose the columns they want to see, and click another button "show" and the list of columns goes away, and the table shows the columns that the user selected.
I have already implemented the column choosing part, but it is the popup part that I need help with. How can I make the div popup and then disappear?
The solution might require javascript, and I might not have figured it out since I don't really know javascript that well.
Thank you.
HI,
Its better to make the display of div to be none rather than setting visibility to hidden. If visibility is set to hidden even if the div doesn't show up but it will take the rendering space which in some situation might not be that good.
You can dynamically create a div using createNode and then by absolute positioning and setting the top and left according to your convenience you can align the div to any portion in the page. Its better if you could disable the background when the div pops out.
Create the div and set visible=false. When you want to pop it up write the javascript to set it visible=true.
here's a good pointer http://lists.evolt.org/archive/Week-of-Mon-20020624/116151.html